Back to Jeff Huang's Main Page

Publishing Quality Images

It seems like the art of including images in publication materials has been lost. I searched online but only found shallow articles describing the many file types, and not a guide for how to use them. I hope this document can lead to fewer charts with compression artifacts, vector graphics that have sadly been saved as pixels, and 10 megabyte pdf files. I have tried to write this with as little technical detail as possible so that everyone can apply these guidelines. Also, there are exceptions to everything written here, but what I'm explaining is the typicaly scenarios.

There are three different image types, and each one needs a different treatment. There are photographs and digital graphics; within digital graphics, there are pixel-based (raster) graphics and vector graphics. One type should never be converted to another type, as they are best stored in their native format.

Photographs are typically represented as jpeg files. These files are delicate. Every time they are saved, they degrade in quality. A photograph can never be made higher quailty, but any change to them makes it lower quality. Cropping them, editing them even a bit, or compressing them down are all actions that reduce their quality. Often even opening them and saving them elsewhere will degrade its quality. A low quality jpeg is easy to notice because it has compression artifacts that look like tiny worms near the sharp contrasts in the image. This is because jpeg images are lossy, which means they are approximated with equations rather than having every pixel described in the file. If you are using a photograph in a publication, then always apply all your changes to the original file once, and then save it into the final file. Do not make some edits, save, make more edits, and save again because this means the quality has been reduced twice.

Raster graphics are digitally created, and are pixel-based. For example, this can include screenshots, pixel art, and interface mockups. The best image format for raster graphics is png, which compress better than gif and have other technical advantages. When using raster graphics, be mindful of the transparency pixel, which is one color in the palette that becomes transparent when overlaid over something else. Always compress your png files before inserting into the final document, because they can often reduce in size by 30% or so. There are even online png compression programs out there, so there's really no excuse not to use the smallest possible files in your document.

Vector graphics are the trickiest to deal with but are also the nicest representation of an image. They are images composed of lines and shapes. Imagine vector graphics as a specification with instructions like "draw a line from the left of the image 2/3s from the bottom to the top right." They will look the same no matter what the resolution, or zoom level, or when printed. It is also a more concise way of describing an image compared to raster graphics, which specifies each pixel. The most common mistake is saving charts as raster graphics instead of vector graphics. Charts, diagrams, logos, wireframes, calendars, and tables should be vector graphics. For example, a chart made in Excel should not be screenshotted or saved as png. Instead, it should be exported or printed to pdf. Always save directly from the application to a vector graphic file type. The most common file types for vector graphics are pdf, svg, and eps. If the application doesn't have an obvious way to export to one of those file type, then try printing to pdf. It's fine to convert between vector graphic file types. One common mistake with vector graphics is ignoring the canvas (artboard), which produces whitespace around the image. Open the file in something like Illustrator, use the white arrow to find and highlight invisible bits in that white space and delete them, then trim the artboard so that the image fills the artboard exactly.

Sometimes, you will find that an application you are using can only save or use one type of image, but you have another type. For example, Microsoft Powerpoint on Windows has difficulty loading in any vector graphic. Or some online drawing tools don't allow exporting vector graphics. When this happens, it's pointless to blame the application but you can still find another application that handles it better. For example, Microsoft Powerpoint on Mac handles loading pdf images just file, which can be part of a slide that is exported as pdf again.

Back to Jeff Huang