Format conversion is mostly a question of what the file is for. Get that right and the conversion itself is one command.
Pick the destination first
| Format | Use it for | Watch out |
|---|---|---|
| JPEG | Photographs, universal compatibility | No transparency; every save loses a little |
| PNG | Screenshots, logos, anything with transparency or sharp edges | Enormous for photographs |
| WebP | Almost everything on the web | Some desktop software still cannot open it |
| AVIF | Photos where size matters most | Support is broad, not universal; slow to encode |
| HEIC | What your iPhone produced | Barely readable outside Apple |
| SVG | Logos and icons that must scale | Vector only. A photo cannot become one |
| TIFF | Print and archival | Very large |
Two rules cover most mistakes. Photographs do not belong in PNG. It is lossless, so it stores JPEG artefacts as though they were detail and the file balloons. Screenshots of text do not belong in JPEG. Lossy compression smears the edges of letters into grey mush.
For one file, or a folder of the same kind of file, a command beats any interface. On macOS, with nothing to install:
sips -s format jpeg photo.heic --out photo.jpg
ImageMagick works anywhere. It reads the format from the extension:
magick photo.png photo.webp
The conversions people actually need
HEIC to JPEG
The most common one. iPhones shoot HEIC by default, and a lot of software can't open it.
sips -s format jpeg IMG_0001.heic --out IMG_0001.jpg
On Windows or Linux, HEIC support depends on codecs that may not be installed. Here a browser tool that brings its own decoder really is less trouble than fixing the system.
Anything to WebP
The best single change for images on a website:
magick photo.jpg -quality 82 photo.webp
Quality 82 is a good default; WebP holds up better at a given quality number than JPEG does.
PNG to JPEG, and the transparency trap
JPEG has no alpha channel. Converting a transparent PNG to JPEG fills the transparent areas with something, often black, and the result looks broken. Flatten onto a known background first:
magick logo.png -background white -flatten logo.jpg
Quality, and when it does not apply
Lossy formats (JPEG, WebP, AVIF) take a quality number. Lossless ones (PNG, TIFF, BMP) ignore it, because there is no trade-off to make.
- 90–100: archival. Large files, no visible gain over 85 for most images
- 80–90: the working range for anything published
- 60–80: thumbnails and previews
- Below 60: visible blocking on any photograph
JPEG to WebP decodes the JPEG and compresses it again, so the new file carries the old damage plus a little more. The size saving is usually worth it, but convert from the original whenever you still have it.
- Work on a copy. Format conversion is not reversible in any useful sense.
- Check the batch really is all one kind. One PNG logo hiding among photographs will come out wrong if you apply photo settings to everything.
- Convert, then spot-check the most detailed image and anything with transparency.
- Keep the originals until you are sure.
Why do this in a browser at all
There are three good reasons, and "it is better than ImageMagick" is not one of them:
- The format is unusual. PSD, XCF, JXL, camera RAW. Installing a toolchain for one file someone sent you is overkill.
- The images are private. An upload-based converter puts them on a server. This one decodes and re-encodes in the tab.
- You want to see what you are getting. A mixed batch is worth checking image by image, and a command line doesn't show you that.