Bitmap images


Martin McBride, 2016-11-29
Tags image pixel metadata
Categories data representation imaging

A bitmap image is made up of pixels. Bitmap images are sometimes called raster images or pixel images.

Common image file formats include JPEG, PNG, BMP and GIF.

Pixels

Pixel is short for PICture ELement. You can think of a pixel as being a small square of colour. A collection of pixels of different colours make up the image you see on your screen, or you print out on your printer. Individual pixels are normally too small to be seen, but this is what an image might look like if you zoomed in on the individual pixels:

pixels

This image has is 20 pixels wide by 10 pixels high, so the image has 200 pixels in total. (This image is very small, most images are hundreds or thousands of pixels in width and height).

The image data stores the colour of each pixel. The image data is usually stored line by line:

Line 0: white, white, white, white, black, white ...
Line 1: white, white, white, black, red, black ...
Line 2: white, white, black, red, red, red ...
etc

For a bitmap image, we don't actually store the name of each colour, instead we use numbers to indicate how much red, green and blue the colour contains. (see colours). Usually we use one byte for each colour, so each pixel takes 3 bytes. The image data for our 200 pixel image would be 600 pixels in size.

Metadata

Image files contain two types of information:

  • Image data - as we just mentioned, the colour data for each pixel. This is usually the largest part of the file.
  • Metadata - information about the image.

Each different type of image file (PNG, JPEG etc) has its own set of metadata which it can store. Also, most metadata is optional. This section just gives an overview of the main types of metadata you might find in an image file.

Data layout

This is information about how the image data is stored, for example:

  • How many bits or bytes are used to store the colour of each pixel.
  • What colour space is used - normally red, green and blue (RGB) but sometimes it can be grey, and sometimes can contains transparency information.
  • What type of data compression (if any) is used.

Image description

This is information about the image content and ownership, for example:

  • The image title, eg "Mount Everest".
  • The owner of the image.
  • Copyright information.
  • Text description and tags
  • Many cameras will add date, time and GPSD location information

Camera information

Most cameras will add manufacturer and model information to the image metadata. High end cameras will also add:

  • Exposure information
  • Flash photgraphy settings
  • Lens used (on cameraas with interchangeable lenses).

Image size

If you take a photograph of a nice mountain for your website, you can make the image any size you like and nobody can really complain. It is just a picture, there is no right or wrong size, and it certainly isn't going to be life size!

Mount Everest

Sometimes, though, you might need a particular image to be printed at an exact physical size. If you were printing an ID badge, it would have to fit exactly in its cover.

ID badge

The image resolution tells us how the pixel size of the image is related to the physical size of the printed image. Resolution is measured in pixels per cm (or sometimes pixels per inch). The printed size can be calculated from:

printed size = number of pixels / resolution

So, if an image is 700 pixels by 500 pixels, and it is printed out at a resolution of 100 pixels per cm, the printed image will be 7cm by 5cm.

Copyright (c) Axlesoft Ltd 2020