1.2.21

Representing Images

Test yourself

Bitmap

Most digital images are stored as bitmaps.

Illustrative background for BitmapIllustrative background for Bitmap ?? "content

Bitmap

  • A bitmap image is split up into tiny squares called pixels.
  • The colour of each pixel is stored as a binary number.
Illustrative background for Colour-depthIllustrative background for Colour-depth ?? "content

Colour-depth

  • The amount of bits used to store the colour of each pixel is known as the colour depth.
  • The greater the number of bits used to represent each pixel, the more unique colours can be stored.
  • Common colour depths are 1-bit, 8-bit, 16-bit, and 24-bit.
Illustrative background for ResolutionIllustrative background for Resolution ?? "content

Resolution

  • Resolution represents the number of pixels in an image.
  • The number of pixels is found by multiplying the width by the height of the image.
  • An example resolution is 1080p which is 1920x1080.
Illustrative background for MetadataIllustrative background for Metadata ?? "content

Metadata

  • Metadata is extra information that is added to an image file such as:
    • The resolution.
    • The colour-depth.
    • The encoding format.
    • The time and date of taking the photo.
Illustrative background for File sizeIllustrative background for File size ?? "content

File size

  • The size (in bits) of an image file is calculated as follows:
    • File size (in bits) = image width x image height x colour depth (in bits)
  • The size of the image file in bytes is equal to:
    • File size (in bytes) = file size (in bits) รท 8

Converting Binary and Images

All images are stored as binary. It's important to be able to convert between an image and its binary representation.

Illustrative background for Binary to imageIllustrative background for Binary to image ?? "content

Binary to image

  • In a black and white image, each pixel is represented by 1 bit:
    • A 0 will represent a black area.
    • A 1 will represent a white area.
  • The image will be represented by a binary string. Use the value of each bit to colour each pixel in the right colour.
  • The binary string starts at the top-left of the image, and represents the first row, followed by the second row, and continues until the end of the image.
Illustrative background for Image to binaryIllustrative background for Image to binary ?? "content

Image to binary

  • Each pixel of the image will be represented by one bit of the binary string.
  • Starting at the top left, and working across the first row:
    • Write a 0 if the pixel is black.
    • Write a 1 if the pixel is white.
  • Continue this process until the end of the image.

Jump to other topics

1Computer Systems

1.1Systems Architecture

1.2Memory & Storage

1.3Computer Networks, Connections & Protocols

1.4Network Security

1.5Systems Software

1.6Ethical, Legal, Cultural & Environmental Concern

2Computational Thinking, Algorithms and Programming

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson