CLI
Usage
Optimize a single image or a whole directory tree from the command line.
The CLI is the fastest way to squeeze images. The core command takes an input path and a target model.
Single image
Terminal
vision-squeezer screenshot.png --model claude
Squeezer runs the full pipeline — semantic crop → tile-aware resize → encode — and writes an optimized file next to the input. It also records the savings in the local stats database.
Choosing a target
Terminal
# Claude: preserve resolution, strip padding (area-based billing)
vision-squeezer image.png --model claude
# GPT-4o: snap under the 512px tile threshold
vision-squeezer image.png --model gpt4o
# Gemini: snap down to 768px tile boundaries
vision-squeezer image.png --model gemini
# Agnostic: no --model, optimize generally across providers
vision-squeezer image.png
See Providers for the math behind each target.
Custom output
Terminal
vision-squeezer image.png --model gpt4o --output optimized.avif --format avif
Batch a directory
Terminal
vision-squeezer ./screenshots --recursive --output-dir ./optimized
--recursive walks subdirectories; --output-dir mirrors the source tree structure into the destination.
Core commands
| Command | Description |
|---|---|
vision-squeezer <image> [options] | Optimize a single image |
vision-squeezer <dir> --recursive [--output-dir DIR] | Batch optimize a tree |
vision-squeezer stats | View cumulative savings analytics |
vision-squeezer setup-hook | Print shell integration (eval) script for Zsh/Bash |
Shell integration
Add a squeeze shortcut to your shell:
Terminal
eval "$(npx -y vision-squeezer setup-hook)"
