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

FlagShortTypeDefaultDescription
--format-fstringwebpOutput format: webp, avif, jpeg, png
--size-sint500Target file size in KB
--output-ostringcompressedOutput folder path
--quality-qint85Initial quality (1–100) for first compression attempt
--workers-wintCPU countNumber of concurrent workers (auto-detected)
--recursive-rboolfalseAlso scan subdirectories
--min-qualityint60Quality floor — compression won't go below this
--max-qualityint90Quality ceiling — compression won't exceed this

Notes

  • --workers defaults to runtime.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-quality and --max-quality define the search range for the binary search algorithm. A narrower range means fewer iterations but may not hit the target size.
  • --quality is 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-quality must be less than or equal to --max-quality, or Shrinkr will exit with an error.

Format Notes

FormatCharacteristics
webpBest default. Excellent quality-to-size ratio. Supported by all modern browsers.
avifSmaller files than WebP but slower to encode. Good for batch jobs where speed isn't critical.
jpegMaximum compatibility. Use for clients or platforms that don't support WebP.
pngLossless. File size depends entirely on image complexity — target size may not be reachable for complex images.