Image colour depth and resolution
Introduction
File size is very important when talking about images. If a file is large, it takes longer for an application to open it. It also takes longer for a file to be sent over the Internet, resulting in longer waiting times for someone wanting to view a site with large image files on it. On top of these points is the fact that a large image file takes up more storage space. This means you can store fewer images on a pen drive or other storage device with a fixed amount of space. The colour depth and resolution impact on the size of an image file.
Colour depth
Consider this picture:
We could store each pixel as a 1 or a 0. That means we can use only 2 colours for this picture. For example, if the bit for a pixel was a 1, then the application opening the image would colour the square black. If it was a 0 then it would be white. Because we use 1 bit, we say that this has a colour depth of 1.
We could store the colour information for each pixel using 2 bits, giving us a total of 4 colours we could use. The first colour would be selected when the bits were 00. The second colour when they were 01, the third when they were 10 and the fourth when they were 11. Because we use 2 bits, we say that this has a colour depth of 2 .
We could store the colour information for each pixel using 3 bits, giving us a total of 8 colours we could use (000, 001, 010, 011, 100, 101, 110, 111). Because we use 3 bits, we say that this has a colour depth of 3 .
We could store the colour information for each pixel using 8 bits, giving us a total of 256 colours we could use (I worked this out by doing the sum 28). Because we use 8 bits, we say that this has a colour depth of 8 .
We could store each pixel using 16 bits, giving us a total of about 65000 colours we could use (I worked this out by doing the sum 216). Because we use 16 bits, we say that this has a colour depth of 16 .
Clearly, the more bits I use for each pixel, the bigger the image file is going to be. Some images just won't look very good if they use use too few bits per pixel. For example, a photograph that uses 8 bits per pixel (256 colours) will look poor as photos use thousands of different colours and shades of colour. For a photo, at least 16 bits per pixel (65000 colours) would be necessary. On the other hand, some images such as icons and simple drawings don't use 65000 colours so 16 bits per pixel would result in unnecessarily large files. 8 bits per pixel (256 colours) would do the job very well.
Screen and printer resolution and Dots Per Inch (DPI)
Visual Display Unit (VDU) resolution is measured by the number of dots, or pixels, that make up a screen. For example, many VDUs used to be set to a resolution of 800 x 600 pixels, or 480 000 pixels. This means the screen is set to 800 columns of pixels by 600 rows of pixels and the images that get displayed tended to be larger and less sharp. You could use a higher resolution if you wanted to, however, perhaps 1200 x 1024 pixels. This means that you can get far more detail on the same size screen, although everything will appear smaller. Historically, resolution is often measure using 'Dots Per Inch' or DPI, which means pixels per inch. You might talk about a screen being 800 by 600 DPI. If you were printing out something, you might set the resolution to 200 DPI or higher. DPI is not the only measure used but it is the most common one.
Resolution and picture size
It is important to understand that pixels do not actually have a length! You may have a picture that is defined as 400 pixels wide and 200 pixels high, but that is not a measure of physical size. It is only a measure of how many pixels there are in the height and width. When the image is to be displayed or printed out, that is when the actual size of the picture is defined. For example, if you have a picture that is 400 pixels wide and 200 pixels high, you may want to print it out at a resolution of 100 DPI by adjusting the printer settings. Your picture will be printed out 4 inches wide by 2 inches high. If you then decided you wanted a more detailed, sharper picture, you might set your printer to a higher resolution, e.g. 400 DPI. Now, the same picture would be printed out and measure just 1 inch by 0.5 inches.
Pixels are dimensionless. It is the resolution that you set your screen or printer to that determines the size images will be displayed at.