When we scan an image and save it for future reference, it's all too easy to simply pick whatever default file format the photo imaging program gives us. Yet the choice of image has an enormous impact on the quality of the result when we eventually go to use that image – particularly if we've decided to print it.
In this guide, we'll go through what you need to know about the common image file formats in use today.
Any member of the Web "old guard" will have used GIF images. GIF is, however, a pretty useless format these days, and is to be avoided wherever possible. Not only is it limited to an eight-bit colour palette (which means no more than 256 different colours in a single image), but unlike other formats, it's also covered by fairly restrictive patents (concerning the compression algorithm it uses, in fact) which may or may not have expired, depending on who you talk to. This means you can never be quite sure if you're processing GIFs legally. The only things GIF has going for it are that file sizes are small and you can do clever stuff like multi-graphic animations, but if you're doing print publishing, you don't really care about either of those.
- Specification: ftp://ftp.ncsa.uiuc.edu/misc/file.formats/graphics.formats/gif87a.doc and ftp://ftp.ncsa.uiuc.edu/misc/file.formats/graphics.formats/gif89a.doc
- FAQ: http://www.faqs.org/faqs/graphics/fileformats-faq/part3/section-57.html
The Tagged Image File Format, created by Aldus (and now administered by Adobe, which acquired Aldus) is an immensely powerful way to store pictures, at least if you're the developer of graphics manipulation software, because a TIFF file isn't restricted to a set header/body structure but instead stores information as a set of "tags" (the concept of "XML for images" isn't a million miles off, if you want to think of it that way). Instead, a TIFF image is an almost infinitely extensible form in which you can store image information in whatever way you wish, use whatever compression technology you wish, and so on (so long as you stay within a 4GB file size, that is).
TIFF files tend to be big, but you can describe a picture precisely in a TIFF, with whatever colour depth you wish. The problem is that although loads of tags are standardised, you can invent whatever new tags you wish. So although the responsible thing to do is register your tags with Adobe, many people don't, and so there's no way anyone can ever build a tool that can understand every single valid TIFF file in the world.
- Specification: http://partners.adobe.com/public/developer/tiff/index.html
- A useful FAQ: http://www.awaresystems.be/imaging/tiff/faq.html
JPEG is actually a committee – the Joint Photographic Experts Group – but when we talk about JPEG, we usually mean the picture file format developed by the aforementioned organisation. In reality, things that we call "JPEG files" are often actually "JFIF" files – that is, they are encoded using the JPEG File Interchange Format.
The key ingredient of JPEG-encoded images is their small file size. As with any IT problem, a saving in one area comes at a cost in another, and in this case, you get smaller files by letting the compression algorithm chuck away some of the detail in your picture – so it's what's called a "lossy" compression algorithm, as you "lose" some of the picture. While this doesn't make a difference in the average case for the average observer, it does matter if you're looking for a way of storing faithful reproductions of your pictures.
- JPEG home: http://www.jpeg.org/index.html
- JFIF specification: http://www.jpeg.org/public/jfif.pdf
The Portable Network Graphics format was designed to take the place of the GIF format, but without the idiosyncrasies and potential licensing issues. Although PNG doesn't do multi-image (i.e. animated) files, it does compress better on average, and it supports 48-bit colour rather than eight-bit. The compression algorithm it uses is also lossless (see JPEG for a comparison) and so although a PNG will never be as small as a comparable JPEG, the reproduction will be faithful. All this makes PNG a very attractive proposition as the standard file format for photographic images, since you get a faithful reproduction and decent colour depth, but at a file size that's smaller than, say, TIFF or BMP.
- Introduction: http://www.libpng.org/pub/png/pngintro.html
- Specification: http://www.libpng.org/pub/png/spec/
Windows BitMaP is a very simple, though surprisingly powerful way of storing your graphics. In its most basic form, a BMP file is simply a list of pixel RGB values, which means that although the file size can be big, you're storing an accurate rendition of your image with no loss. If you're feeling so inclined, there's a compression option associated with BMP, though to coin a phrase: "Not many people know that", and consequently nor do a lot of graphics manipulation packages.
BMP is Windows' native file format, but because most packages support it (at least in its uncompressed guise) it's not a bad choice for storing your master images.
- BMP FAQ: http://www.faqs.org/faqs/graphics/fileformats-faq/part3/section-18.html
- Specification: There isn't really a single spec document – but the FAQ (above) has some useful pointers
Encapsulated PostScript is (surprise!) a derivative of Adobe's PostScript page description language (and, for that matter, a sibling of PDF, the Portable Document Format). It was devised as a means of incorporating pictures inside other documents, but the syntax and the majority of commands will be recognisable to anyone who's ever looked in any detail at a PostScript file.
EPS describes the image you're storing. That is, it doesn't simply hold a set of dots that make up a photo, but it actually says things like: "Using (x,y) as your centre, draw an arc with the following function, and make it this colour". This means that you can scale up an EPS with no loss of detail, because instead of having to figure out how to interpolate the dots of an image, the system can simply recalculate where to put things and then render them appropriately.
EPS is most useful, then, when you're actually the originator of a picture (a diagram, say). Don't even think about using it for scanned photos or digital camera output, as the file size will be huge and formats such as PNG will be better.
- The difference between PostScript, EPS and PDF: http://www.rdpslides.com/psfaq/FAQ00019.htm
- Specification: http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf
|Format||File size||Lossy?||Important stuff||Best for|
|GIF||Small||No||Licensing issues, lousy colour depth||Nothing any more, really|
|TIFF||Big||Yes or no - depends on compression chosen||Best to avoid custom tags, or format translation gets awkward||Image libraries with big data stores|
|JPEG||V. small||Yes||Web pages|
|BMP||Big||No||Windows-based image libraries|
|EPS||File size||No||Home-grown diagrams|