3️⃣Representing Images

Learn how Images are represented through 0s and 1s.

Computer Data

As you already know, computers often have to store and process real life data. However, for it to be able to process the data, the data must be in binary format, as computers can only understand 0s and 1s. Computers use discrete values (in binary) in order to represent the images, and the data is processed in discrete steps. This is called digital data.

On the other hand, natural data is called analogue data. This is because the data is represented in continuous manner and there are no discrete values.

'Seeing' Images

Humans are able to see images because of the light which is reflected by the objects they are looking at. Light is transmitted as waves, and because of that, changing wavelengths produces different colours which can then be detected by the eyes.

There are infinite number of possible colours due to them being analogue, however humans cannot detect them as human vision is limited. When a photograph is taken via a digital camera, the computer needs to capture and approximate the colours as discrete values.

Capturing an image

When a digital camera captures an image, it breaks up what it sees through its lens into a grid of pixels. The light sensor of the camera measures the intensity of the colour in each pixel. Then each of the measurement (intensity of colour) is converted into binary using an electric component called analogue-to-digital convertor.

What the camera sensor sees

Analogue signal which is detected by the camera sensor.

Digital Approximation

Discrete values are used to give an approximation of the colours at certain positions.

Bitmapped (Raster) Graphics

Bitmapped graphics are created using a grid of pixels, where each pixel is assigned a binary value which determines the colour of the pixel.

An example of a bitmapped graphic

Common Bitmap filetypes: BMP, JPG, GIF, PNG and TIF.

Bitmap Resolution

Resolution refers to the number of pixels used to represent the bitmap image. Often, resolution is expressed as the number of dots per inch squared, where a dot is a pixel.

The image shows how resolution affected image quality.

Resolution is defined as width × height

  • A typical bitmap resolution might be 1000 × 1000

  • This would mean that a total of 1,000,000 pixels would be used

  • Typically, this would be referred to as 1 megapixel image

Image Pixelation

Resolution doesn’t define the actual physical size of an image.

  • If an image is enlarged, the size of each pixel grows in order to maintain the required resolution.

  • This is why there is a deterioration in quality (pixelation) when they are resized.

Creating Bitmapped Images

Bitmapped Image

The image above shows the concept of creating bitmapped images. Each value represents a different colour, using one bit per pixel only allows two possible colours, as there can only be two values (0 and 1). 0=BLACK, 1=WHITE

Bitmapped Image with more colours

This new image shows the idea that having more bits per pixel increases the number of possible colour combinations. The number of bits per pixel is called the image's colour depth.

Colour Depth

A higher bit depth gives a greater range of colour and a better quality of image. As a consequence, increasing the bit depth also increases the file size.

8 bits per pixel = 2^8 = 256 colours
16 bits per pixel = 2^16 = 65536 colours
32 bits per pixel = 2^32 = 16777216 colours 
n bits per pixel = 2^n colours

Colour Values

Visual Representation of colour values

Colour values are usually expressed as denary RGB values and in hexadecimal, and not in binary. This is done to make it easier for graphics designers to memorise different colour codes, and also it takes less space on the screen when writing.

RGB values range from 0-255, this tells us that there are 256 variation of the colours, this tells us that 8 bits are used to represent each colour in binary. There are three sets of 8, because of (Red, Green, Blue) -> 8 * 3 = 24 so 24 bits are used to represent RGB colours.

In some cases, you will see 32-bits being used to represent colours. In that case, the last 8 bits are used to represent the transparency of the colours.

Calculating File Size of Bitmapped Images

Image file size is determined by the number of pixels used and the colour depth. Therefore, the formula to calculate the minimum file size is: N of pixels * colour depth

The primary reason why we call this a minimum value is due to the fact that files also have metadata which also adds to the file size.

Vector Graphics

This is when geometric objects and shapes such as rectangles, circles and lines are used to create images. The properties (e.g. dimensions and colours) of each object or shape in the image are stored in a list.

Vector Graphics
Bitmapped Graphics

Can be rescaled without losing quality

Can become blurry and pixelated when enlarged

Well suited to simple images that use shapes, but not good for photographers

Used for storing photos

Frequently use less space

Often use more space than vector graphics

Metadata

Metadata is simply data about data and it is stored in the same file as the image data.

Metadata includes things like:

  • Data creation date

  • Width and height of the image

  • Colour depth

  • Camera details

  • GPS coordinates of where the image was takes

[Please note that metadata is not exclusive to image files]

Last updated