Flags Reference
All CLI flags, short forms, defaults, and descriptions.
Flags Reference
All flags are optional. Shrinkr has sensible defaults for every setting.
Full Table
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--format | -f | string | webp | Output format: webp, avif, jpeg, png |
--size | -s | int | 500 | Target file size in KB |
--output | -o | string | compressed | Output folder path |
--quality | -q | int | 85 | Initial quality (1–100) for first compression attempt |
--workers | -w | int | CPU count | Number of concurrent workers (auto-detected) |
--recursive | -r | bool | false | Also scan subdirectories |
--min-quality | — | int | 60 | Quality floor — compression won't go below this |
--max-quality | — | int | 90 | Quality ceiling — compression won't exceed this |
Notes
--workersdefaults toruntime.NumCPU()— the number of logical CPU cores on your machine. On Apple Silicon M-series chips this is typically 8–12. You rarely need to change this.--min-qualityand--max-qualitydefine the search range for the binary search algorithm. A narrower range means fewer iterations but may not hit the target size.--qualityis the starting point. If the image is already under the target size at this quality, Shrinkr stops immediately (no binary search needed).--recursive(-r) scans all subdirectories. The output folder mirrors the input directory structure.--min-qualitymust be less than or equal to--max-quality, or Shrinkr will exit with an error.
Format Notes
| Format | Characteristics |
|---|---|
webp | Best default. Excellent quality-to-size ratio. Supported by all modern browsers. |
avif | Smaller files than WebP but slower to encode. Good for batch jobs where speed isn't critical. |
jpeg | Maximum compatibility. Use for clients or platforms that don't support WebP. |
png | Lossless. File size depends entirely on image complexity — target size may not be reachable for complex images. |
