WebP — the safe default
Excellent compression, supports transparency and lossless, and is supported
by every current browser. If you’re unsure, choose webp.
Converting is just compressing into a different format. Set -f, --format and
imgsqz reads your source (any format sharp understands) and writes the target.
imgsqz input.png -f webp # PNG → WebPimgsqz input.jpg -f avif # JPG → AVIFimgsqz input.webp -f jpg # WebP → JPGimgsqz input.tiff -f png # TIFF → PNG-f value | Extension | Best for |
|---|---|---|
jpg (or jpeg) | .jpg | Photos, universal compatibility |
png | .png | Graphics, transparency, lossless |
webp | .webp | Modern all-rounder, great compression |
avif | .avif | Smallest files for photos, modern browsers |
tiff | .tiff | Archival / print workflows (LZW compressed) |
WebP — the safe default
Excellent compression, supports transparency and lossless, and is supported
by every current browser. If you’re unsure, choose webp.
AVIF — the smallest
Typically beats WebP by 20–50% on photos at similar quality. Use it where your audience’s browsers support it (all modern ones do).
JPG — maximum reach
When something must open everywhere — email, legacy apps, print shops — JPG with mozjpeg is still a great choice.
PNG — graphics & transparency
Logos, icons, screenshots with text, anything needing an alpha channel and crisp edges.
# PNG screenshot → compact WebPimgsqz screenshot.png -f webp -q 80
# Huge camera JPG → tiny AVIF for the webimgsqz IMG_4821.jpg -f avif -q 50 --width 1600
# WebP back to JPG for an app that can't read WebPimgsqz asset.webp -f jpg -q 85
# PNG with transparency → lossless WebP (keeps the alpha channel)imgsqz icon.png -f webp --losslessWebP, AVIF and PNG all support an alpha channel, so transparency is preserved
when converting between them. JPG has no transparency — converting a
transparent PNG to JPG flattens the alpha (transparent areas become black/white
depending on the source). If you need transparency, target webp, avif, or
png.
Convert every PNG in a directory to WebP at once:
imgsqz *.png -f webp -q 75Each file is written next to its source with a timestamp suffix. For predictable names or in-place replacement, see Output paths & naming and Replacing files in place.
Next: Resizing & fit modes.