Storing Images

Cards (24)

  • Images and sounds are pieces of data stored on computers - so, naturally they're made of bits
  • Images are stored as a series of pixels
  • Most images you use are bitmap images - e.g. photos. They're made up of lots of tiny dots, called pixels
  • The colour of each pixel is represented by a binary code. The number of colours available in an image is related to the number of bits the code has
  • Black and white images only use 2 colours, so they need 1 bit for each pixel
  • 2-bit images can be made up of four colours. Each pixel can be one of 4 binary values - 00, 01, 10, 11
  • You can make a greater range of shades and colours by increasing the number of bits for each pixel
  • Increasing colour depth and resolution increases the file size
  • The colour depth is the number of bits used for each pixel
  • Given the colour depth you can work out how many colours can be made using the formula:
    Total number of colours = 2^n (where n = number of bits per pixel or bbp)
  • 1-bit image: 2^1 = 2 colours
  • 4-bit image: 2^4 = 16 colours
  • 12-bit image: 2^12 = 4096 colours
  • Most devices have a 24-bit colour depth, with 8 bits for the levels of red, green and blue in each pixel. This colour depth can produce more colours than the human eye can see (estimated to be 10 million)
  • The image resolution is the number of pixels in the image. It's sometimes given as width x height
  • The higher the resolution, the more pixels the image is made of, so the better the quality of the image
  • To work out how many bits an image will take up, use the formula:
    File size (in bits) = image resolution x colour depth = width x height x colour depth
  • Using a greater image resolution or colour depth means that there are more bits in the image. This can give a higher quality image, but increases the file size
  • Example
    Calculate the file size, in MB, of an 8-bit image that is 2000 pixels wide and 1000 pixels high
    • Use the formula to find the size in bits:
    > 2000 x 1000 x 8 = 16,000,000 bits
    • Divide by 8 to convert to bytes:
    > 16,000,000 / 8 = 2,000,000 bytes
    • Divide twice by 1000 to convert to MB:
    > 2,000,000 / 1000 / 1000 = 2MB
  • Devices need metadata to display the images
  • Metadata is the information stored in an image file which helps the computer recreate the image on screen from the binary data in each pixel
  • Metadata usually includes the image's file format, height, width, colour depth and resolution
  • Without metadata, devices would not be able to display the image on screen as intended
  • Metadata can also include information like the time and date that the image was created or last edited