Sub topic 17
Export tools and workflow
This chapter assumes you know the image formats from earlier chapters (JPEG, PNG, SVG, WebP, AVIF), how to pick export dimensions, and how to set a compression quality. It covers how to run those decisions through a tool, so the result is the same every time.
Two kinds of tools
Design tools such as Figma, Sketch, Photoshop, and Illustrator export from the canvas. Command-line tools such as ImageMagick and cwebp convert files that already exist. Each suits a different job.
| Tool type | Best for | Weakness |
|---|---|---|
| Design tool export panel | One-off assets, icons, slices of a layout | Clicking through settings is slow and easy to get wrong |
| Command-line tool | Batches, repeatable settings, extra formats | Needs a terminal and a source file to start from |
A workflow that holds up
A good workflow exports one large master, then makes every other file from it.
- Export the master from your design tool at the largest size you need, usually the 2x size, as a lossless PNG.
- Resize the master to each target width.
- Compress each size to the formats you chose.
- Compare file sizes with your budget and adjust the quality if a file is too large.
Never re-compress a JPEG that was already compressed. Each pass loses more detail, so always start from the master.
Exporting from a design tool
In Figma, select a layer or frame and add an export setting in the Export section of the right panel. You can add several rows to one layer, such as 1x and 2x, and Figma adds a suffix like @2x to each name. Choose PNG, JPG, SVG, or WebP, then export. Sketch and Adobe tools have similar panels. Set the scale, the format, and the suffix once per layer, and the settings travel with the file.
Batch conversion on the command line
The commands below produce a JPEG and a WebP from a 1600 pixel master. ImageMagick resizes, removes metadata, and sets quality 80. Then cwebp writes the WebP.
magick hero.png -resize 1600x -strip -quality 80 hero-1600.jpg
cwebp -q 80 hero-1600.png -o hero-1600.webpThe second command reads hero-1600.png, so you need a PNG at that width first. To make one, run magick hero.png -resize 1600x hero-1600.png. To repeat the work for several widths, wrap the commands in a loop. Your settings then live in a script you can rerun, instead of in your memory.
Common errors
- Exporting from a design tool at 1x and later scaling up to 2x, which blurs the image.
- Compressing the same JPEG twice.
- Forgetting to strip metadata, so each file carries camera data and large color profiles.
- Mixing up the order of options, such as setting
-qualitybefore a later step that changes the file.
Exercise
Why should you create every JPEG and WebP from one lossless master instead of converting one JPEG into the next size?
Show answer
Each JPEG save loses detail, so converting a compressed copy compounds the loss. A lossless master keeps all the detail, so each output is compressed only once.