Image quality or file size? You choose.
This resource is based on a series of interactions in the Ask a Techo forum on 9 July 2004
There’s no way to escape it. When it comes to capturing and storing image files, at some point you have to find the balance between sacrificing image quality or having huge storage problems.
Let’s look at some of the basics about image files and their size.
There are two distinct file compression families known generally as 'lossless' and 'lossy'. The first uses algorithms to compress the file size but throws nothing away. The second compresses files even further by changing some colours in the image to be the same as the neighbouring pixels then discards the original information.
Generally the second type will produce smaller file sizes but they suffer badly from generational loss, ie each subsequent edit results in a degraded image. To avoid this you need to keep a copy of the original in a lossless format - TIF, PGN, BMP, WMF or GIF, and use this image to produce your compressed JPG images. For simple line drawings (cartoon style artwork) GIF files are the most effective. For photo style images JPEG or JPG files are best. The JPEG format will allow you to compress the file more but being of the “lossy” type, they result in a loss of image quality. You'll need to experiment a bit to find out where the balance between file size and recognisable images lies for the type of images you’re working with.
The compression algorithm is only one factor that determines file size. The other is the sheer amount of raw data you start off with. Photo quality prints are what is called “high resolution” - about 1200 dots per inch. That means there are 1200 x 1200 = 1,440,000 dots for every square inch on the print.
When printing a photo-real image you need around 1200 dpi, but to show it on the computer screen you only need about 72. So if your camera or scanner is capturing and saving for a photo-real result you're actually making the image 16 times too big.
The next thing is the colour depth, the more colours you try to display the larger the image file will be. To describe exactly what colour each of the dots has to be, we need at least 24 bits of information (some people use 48bit) and when you multiply it all out, a 48bit 1200dpi image comes to nearly 64 MB. In 24 bit the same file reduces to 32 MB while a 16bit 600dpi image only takes up 6 MB. In many cases, cutting an image's resolution and/or colour depth can significantly reduce the file size without any noticeable degradation in the image quality. It really depends on the type of image.
So, although compression is one way to reduce file size there are other ways.
- Take smaller pictures
- Use plain colour backgrounds (they compress better)
- Save your images with fewer colours. If you can save your images in 16bit colour you can make big savings in disk space
- Reduce your photo resolution. Mug shots in 600 dpi (dots per inch) will look just about as good as 1200 dpi
Read our article on How to prepare photos for the web for further information.