Image conversion sounds mechanical, like copying a file under a new name. It isn’t. When you decode a JPEG and re-encode it as AVIF, you unpack millions of pixels from one compression model, shuffle them through a new codec’s mathematics, and write a fundamentally different binary to disk. Three things decide the outcome: the source, the codec settings, and whether you understand what each format can and cannot hold.
01What you’re actually doing
Formats split into two families. Raster images are grids of pixels; vector images describe shapes with maths. Converting between families is a one-way door — you can rasterise an SVG, but you can’t turn a photo back into true vectors. Within raster, the other divide is lossy versus lossless: every lossy re-encode is a generation loss. Work from the highest-quality source you can find, and only compress lossy at the final output step.
Colour space is the silent killer. Strip a camera profile without converting and greens oversaturate, reds go flat. Good converters handle this; careless ones don’t — watch it especially with RAW and HEIC.
02The tools: command line, GUI and web
ImageMagick ↗ is the closest thing the command line has to a universal converter — hundreds of formats, colour management, batch processing. A basic conversion reads the target format straight from the extension:
magick input.png output.webp
magick input.jpg -quality 60 output.avif
magick input.jpg -strip output.jpg # drop EXIF before publishingffmpeg ↗ is known for video but handles stills and animation fluently — it’s the best command-line route for animated WebP and AVIF. GIMP ↗ covers hands-on editing and export; Squoosh ↗ runs the real encoders in your browser with a live side-by-side preview — ideal for one-off jobs where you want visual confirmation before you commit.
ffmpeg -i animation.gif -vf "fps=15,scale=480:-1" animation.webp03Format-by-format
04Delivering converted images
Converting to WebP or AVIF only helps if you serve it to browsers that support it. The <picture> element offers formats in order and the browser takes the first it can decode:
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="Description" width="800" height="600">
</picture>Know your source, respect the format’s constraints, and only compress as far as your audience will forgive.
The tools have changed considerably since the first batch converters ran on Unix workstations. The discipline hasn’t.