www.creativephotobook.co.uk   •   © 2008 Colin Bell and Phil Thomas

 

Contact us

   

Click one of the icons above to contact us by e-mail or through our blog.

 

The Digital Domain: How Images Are Stored

This chapter on 'The Digital Domain' looks at aspects of digital photography after you have captured the photograph and are sat in the confort of your computer chair.  We will also delve a little deeper into a few of the things we have already touched upon in earlier chapters.

How Images are Stored

We've already seen that an image is made up of individual pixels.  If you are shooting at the highest pixel resolution that your camera can handle, then each pixel in the image corresponds to a pixel on the image sensor.

Each pixel has a specific colour which is defined by the amount of red, green and blue at that pixel.  These separate colours are usually referred to as channels in an image - therefore a full colour image requires three channels.  In most image formats, each channel requires 1 byte of memory therefore each pixel requires 3 bytes to store.  Each channel has 256 different levels for each colour a value from 0 indicating none of that colour and a value of 255 indicating the maximum amount of that colour.

For example if a pixel has an RGB value of (255, 128, 10), it will be made up of about 100% red, 50% green and just a tiny bit of blue.  This happens to be a fairly vivid shade of orange.

A value of (0,0,0) is pure black, and a value of (255,255,255) is white.  If all the numbers are the same – you will get a shade of grey.

             

0,0,0

255,0,0

0,255,0

0,0,255

255,0,255

255,128,0

255,255,255

Bits and Bytes ... Is it time for dynner yet?

In the world of digital, everything is represented as numbers – whether it’s the text on this web site, a movie on DVD or a digital photograph.  The smallest unit of storage is a ‘bit’ which can have the value ‘0’ or ‘1’.  This is not particularly practical so these are grouped into blocks of 8 bits called ‘bytes’ (for example 10011011). This gives you 256 possible combinations.

Each extra bit that your add doubles the number of combinations so therefore a 9-bit number would have 512 combinations, a 10-bit would have 1,024 combinations etc.

In typical computer humour and purely for interest, 2-bits is known as a tayste, 4-bits (half a byte) is called a ‘nybble’, and 32-bits is known as ‘dynner’.

Colour Depth

By now you should be very familiar with the concept of a pixel - an individual coloured dot that makes up the picture.  However something just as important as the number of pixels (maybe more so) is the number of possible colours that each pixel can be.

Artists (painters) usually have a range of basic colours from which they can mix a near infinite number of different shades.  Computers mix these shades from the 3 primary colours of light - red, green and blue.  The more precisely you can control the amount of each colour, the more different colours you can have for each pixel.

For example if you could only mix equal amounts of each, you would have a maximum possible palette of only 8 colours (this is like a computer just using 1-bit of memory for each primary colour.  If you use 2-bits for each colour - you have 4 levels for each primary colour (none, a little bit, a bit more, and maximum) - this would give you 64 different possible colours by mixing all combinations of red, green and blue.

This concept of having a different number of possible colours for each pixel is called colour depth.  The greater the colour depth, the more possible colours available for each pixel.

Both of the examples given above are far too limiting for use within digital photography, however here are some of the more standard colour depths you might come across:

8-bit colour - This is an old format (although still used by GIF images which appear on many web pages) which is limited to a maximum of only 256 colours per image, and hence is of limited use for photographic images.  8-bit colour is usually a paletted format (see the Blue Nerd Box below).

Paletted Colour

With digital images, it is best to have the colour at each pixel defined directly - i.e. described by the amount of red, green and blue at that pixel.  However for this to work well requires a fairly high colour depth (at least 24-bit colour - see below).

Some image file formats make use of a colour palette which is stored in the image file and can be optimised for the colours in the image it is storing.  The most common palette file format is GIF which is still used on many web sites.

For any image a palette is created of 256 colours.  This palette can be optimised (i.e. if the image is primarily blue, the palette can contain 250 shades of blue and 6 others).  The palette is picked from the 16 million colours available in 24-bit colour images.

Paletted colour files like GIF are better than JPEG for images that have limited number of colours (i.e. drawn logos, clipart etc.), but are not of any use for photographs that contain continuous tones.

24-bit colour - 24 binary digits are required to describe the colour of each pixel - 8 bits for red, 8 for green and 8 for blue.  JPEG files are nearly always in this format.  This is sometimes incorrectly called 8-bit colour - what it should be described as is ‘8-bits per channel’.

Greyscale - this is actually an 8-bit format that uses a single colour channel as opposed to a palette.  It is able to represent 256 different shades of grey from pure black to pure white.  This is an alternative format for JPEG files.

16 million colours - the approximate number of different colours possible with 24-bit colour, and therefore sometimes used as an alternative name for 24-bit colour.

True colour - another name for 24-bit colour as it describes approximately how many different colours can be represented in 24-bits.  This is considered the minimum colour definition needed to store photographic images.  For example if you stored the red, green and blue in just 4-bits – you would instantly halve the file size, but each colour would only have 16 combinations and you would see the discrete colours in the picture rather than smooth continuous tones.

12/36 bit colour - uses 12 bits per primary colour (36 bits per pixel).  This increases the colour resolution up from 256 levels per RGB component to 4,096 levels per component. (over 68 billion colours). Many RAW files use this to create a more accurate representation of the colour in the file, however once this is converted to a JPEG file, you are back to 24-bit colour depth.

16/48 bit colour - used primarily in photo-editing where each RGB component is represented by a 16-bit number.  It allows the precision to be maintained when applying a sequence of processing techniques, a situation where 8-bit colour images might start to deteriorate.  Few file formats support 16-bit colour - TIFF and Photoshop PSD files are two that do.

Examples of Colour Depth

24-bit colour (16 million possible colours) 1-bit per primary colour (8 possible colours) - the one that's not shown is black. 2-bits per primary colour (64 possible colours)
3-bits per primary colour (512 possible colours) 256 colours (paletted) - the palette has been optimised so it looks better than the 3-bit image on the left. 256 colours (paletted) - instead of picking the nearest colour, an error diffusion algorithm has been used which gives a more grainy appearance but with smoother colour transitions.  Looks OK here, but on a photograph, it would be rather poor.

crop from a 24-bit image crop from an optimised 256-colour palette version of the same image. See how having such a limited number of colours has created patches of the same colour

Lets now look at some of the more common file formats in a little more detail ...

 

 

Photographs

This is a site about photography so I'm sure you are expecting to see plenty of pictures.

For now, why not take a peek at the flickr galleries belonging to the two authors of this site.

Colin's Flickr Page

Phil's Flickr Page

 

"There's only one rule in photography - never develop colour film in chicken noodle soup."
      - Freeman Patterson