convert is the explicit one: you say which files, which format, and what quality. For running a
whole folder through sensible defaults, use optimize instead.
Arguments
What to convert. Takes any mix of files, directories (expanded recursively to the image files
inside), and glob patterns — quote patterns so your shell doesn’t expand them first.
Names containing glob characters are handled literally when the file exists —
holiday (1).png
converts without any escaping.Options
Target format, or several separated by commas:
jpeg, png, webp, avif. Each input
produces one output per format.Scale so the longest side is at most this many pixels. Never upscales. Mutually exclusive with
--resize-percent.Don’t apply EXIF orientation before encoding. By default photos are rotated upright first, so
they stay correct once the metadata is gone.
Several formats at once
Pass a comma-separated list and each input produces one output per format — useful for shipping a modern format with a fallback:Not overwriting things
By default a name collision gets a numeric suffix —photo.webp, then photo (1).webp. Your
originals are never touched.
rename (default)
rename (default)
Adds
(1), (2) and so on. Nothing is lost.overwrite
overwrite
Replaces an existing output of the same name. Useful for repeatable builds where the output
directory is disposable.
skip
skip
Leaves the existing file alone and reports the input as skipped. Good for resuming a large
batch.
Dry runs
--dry-run does the full decode and encode — so the reported sizes are real — but writes nothing:
Manifests
--manifest writes a JSON report, which is what you’d parse in CI:
results.json
files has: