Image Formats: GIF, JPEG, PNG and More

When you want to put graphics on your website, you’ll face an unexpected problem: what format should they be in? On their own computers, many people save pictures in Windows’ default BMP (bitmap) format, but the files it creates are simply much too large to put on a website – they’d take about a minute for visitors to download and use up all your bandwidth in the process.

When you put pictures on the web, you need to consider the trade-off you want between image quality and speed: the smaller the file, the worse it’s going to look. To help you out, here’s a comparison.

GIF

GIF stands for Graphics Interchange Format, and was the first image format used on the web. It was invented by CompuServe in 1987, updated in 1989, and hasn’t changed since – and it shows. Images stored in GIF format can only use a maximum of 256 colours, which makes things like photographs and logos look terrible. GIFs popularity is mainly due to it being first and producing very small files, although it is also notable for being the only image format that allows you to create small animations.

Really, the only things you should use GIFs for now are files that have a limited number of colours, and are technical in nature – diagrams, for example, work well in GIF format.

Things like photographs that use many colours will come out looking very strange.

JPEG

JPEG was designed by the Joint Photographic Experts Group, who gave it its name. It was designed as a format suitable for storing high-quality photographs at low file sizes – file sizes small enough to put on the web. Today, the format is supported in almost all web browsers, and is also the format that you’ll get photos in if you take them with a digital camera.

The most important feature of JPEG is both the best and worst thing about it: lossy compression. The word ‘lossy’ means that data is lost from the picture when it is saved at
smaller file sizes. Image-editing programs will generally let you choose how much compression you want, from none (highest quality, large file size) to 100% (very small files,
but terrible quality). Unfortunately, JPEGs that have been compressed too much come out looking worse than useless, but many people still use high compression settings out of a misguided desire to have the very smallest files possible. If you’ve ever seen images on the web that look very ‘blocky’, you’ve been a victim of JPEG compression.

If you do use JPEG, then, it’s really recommended that you turn compression off altogether, or use a maximum of about 25% – the files are quite small already, without going overboard with the compression.

PNG

PNG stands for Portable Network Graphics, and is the newest web image format in widespread use. It was designed as a replacement for the outdated GIF format, allowing
files to use millions of colours instead of only 256. PNG files have smaller file sizes than GIFs, although they are often larger than JPEGs, since PNG compression is lossless (never loses any image quality).

The most useful feature of PNG is that it supports something known as ‘alpha transparency’: basically, images with transparent backgrounds that blend in perfectly. The
only thing stopping widespread adoption of this feature is that it isn’t currently supported by Internet Explorer, but there is a workaround for this problem: search for ‘AlphalmageLoader’ for more information.

Converting Between Formats

For most purposes on the web, all the graphics you want to use should either be in JPEG format (for photos) or PNG format (for less complicated graphics). That’s a problem if you’ve got a collection of images in all sorts of other formats.

Luckily, a good image editor should be able to convert from any format to any other very easily. In Paint Shop Pro, for example, you simply open your images and save them again using whatever format you want – you can even run the ‘Batch Converter’, which will convert a whole folder full of files all at once. If you don’t have an image editing program, there are plenty of free image viewers that will do the same job for you.

Leave a Reply