Graphics - File formats

The term lossy (pronounced loss-ee) refers to the way file formats store information. TIFF, PSD and PSP are considered non-lossy, as no data is discarded when files are saved in those formats: files are simply compressed. However, both GIF and JPEG formats discard information in order to reduce file sizes - hence, they are classed as lossy.

Page Break

Photoshop, Paint Shop Pro and other graphics programs have their own proprietary file formats (e.g., PSD, PSP). The file sizes are quite large, but if you are creating or manipulating an image, stick with the program's own format until you are finished - they often load more quickly and are non-lossy. If you keep opening a file in a lossy format, then make changes and save it again, you will start to lose quality each time.

So, if you are using Paint Shop Pro and want to edit a JPEG for a Web site, first convert the file to a PSP format and then make the changes. When you are satisfied with the image, convert it back to a JPEG.

Page Break

After working with images for the Web and print, most people fall in love with the JPEG format. It stores images at 16 million colours and you can set your own resolution. Two additional tricks mean file sizes are compact and you have control over image quality versus file size.

First, JPEGs are optimised for the human eye, which is more sensitive to changes in brightness than colour. A JPEG discards some of the colour information (also called undersampling), thereby reducing the amount of data in an image.

Its second trick is the compression setting, sometimes called the quality setting. Simply put, if two dots next to each other are very close in colour, they will be replaced by two dots of the same colour that is an approximation of both. So, instead of storing the information for two separate dots, it draws the new single dot twice - this requires less data. The quality setting tells the JPEG format how close the dot's colours must be before combining them. A high quality setting will mean that dots will have to be very similar before they are combined; a low quality means they can be quite far apart.

For print, the setting should be high, but for the Web, it should be in the lower range - "3" in Photoshop or "30%" in Paint Shop. JPEGs for the Web should be no more than 72dpi. For print, JPEGs should be at least 300dpi. Another feature is that JPEGs (and GIFs) can be easily transferred between various platforms such as Mac, Linux, BeOS and Windows.

Page Break

This format is popular on the Internet but is getting a little dated. GIF has two very important limitations - it can only display images at 72 dpi and a maximum of 256 colours. The format is unsuitable for print media, which typically requires a minimum of 300dpi, but its small file size and the fact that most monitors only display 72dpi make it ideal for the Internet - but only for logos or images with fewer than 256 colours. When converting to GIF format, you will lose a lot of colour and quality - the resulting image will have a small file size but photographs will take on a very grainy appearance. In most circumstances, a JPEG is preferable.

Since GIF is a lossy format and discards a lot of information, never use GIF for storing images that you intend printing or changing in the future (use a TIFF). GIF files can also be used for Web animation (a future topic of Here's How Graphics).

Page Break

In the early days of PC graphics, many images were created by positioning small, single-coloured dots on a page. As the quality of screen displays improved, so did the number of dots (or pixels) and colours. It wasn't long before these bitmap files became huge and inefficient at storing data. Techniques were developed for compressing the image data, leading to the development of TIFF files.

Most TIFF files use LZW Compression which works on a very simple idea. Instead of recording the dots one by one, it looks for patterns and replaces these patterns with a symbol. Each time the pattern reappears, the symbol is used (a bit like a dictionary). To rebuild the picture, each symbol is looked up in the "dictionary" and replaced by the original sequence of dots. TIFFs are ideal for storing files without losing quality and are especially useful when transferring files between incompatible graphics packages (provided you use the same compression option such as LZW). There are no inhibiting limitations on the number of colours or resolution, but the files can be quite large and difficult to transport. TIFF is a non-lossy format and is quite suitable for print media, but it is unusable on the Web. Avoid using BMP as the files are unnecessarily large.

Page Break

This month will cover the most fundamental and often confusing area of graphics - file formats.





lossy and non-lossy