Representing Pictures Digitally: KS3 Computing Study Notes
Welcome to this guide on how computers see, store, and display pictures! Have you ever wondered how a photograph of your pet or a screenshot from your favourite video game is stored inside a computer? Computers cannot see colours or shapes the way our eyes do; they only understand binary (sequences of \(0\)s and \(1\)s). In this chapter, you will discover the clever tricks computer scientists use to turn numbers into beautiful digital artwork.
Don't worry if maths and binary seem a little tricky at first. We will break down every idea step by step using simple real-world examples!
---1. Digital Images: Pixels and Grids
What is a Pixel?
The word pixel is short for picture element. A pixel is the smallest single point or dot of colour in a digital image.
Think of a digital picture like a giant mosaic made of tiny square tiles. If you stand far away, you see a smooth picture. If you look really close with a magnifying glass, you can see each individual square tile. In computing, each square tile is a pixel.
Bitmap Graphics (Raster Graphics)
A bitmap graphic (also known as a raster graphic) is an image made up of a grid of tiny pixels. For every single pixel in the grid, the computer stores a binary code representing its colour.
Black and White (Monochrome) Images
The simplest type of image uses only two colours: black and white. Because there are only two choices, we only need \(1\text{ bit}\) per pixel to store the colour:
• \(0 = \text{Black}\)
• \(1 = \text{White}\)
(Note: Some systems might use \(0\) for white and \(1\) for black, but the rule remains: \(1\text{ bit}\) can store \(2^1 = 2\) different colours.)
Quick Example:
Imagine a tiny heart icon on a grid that is \(4\text{ pixels}\) wide and \(4\text{ pixels}\) high. The computer stores it as a row of bits like: \(0110111111110110\). When the computer reads this grid, it turns every \(0\) black and every \(1\) white to draw the shape on your screen!
Key Takeaway: Bitmap images are grids of pixels. In a basic black-and-white image, each pixel needs just \(1\text{ bit}\) of storage (\(0\) or \(1\)).
---2. Colour Depth (Bit Depth)
What is Colour Depth?
Black and white pictures are simple, but what about full-colour photographs? To show more colours, we must use more bits for each pixel. Colour depth (also called bit depth) is the number of bits used to represent the colour of a single pixel.
The Formula for Available Colours
Every time we add \(1\text{ bit}\) to the colour depth, we double the number of available colours we can display. The rule is:
\(\text{Number of Colours} = 2^n\)
(where \(n\) is the colour depth in bits per pixel)
Let's look at how the number of colours grows as we increase the bits per pixel:
• \(1\text{ bit per pixel}\): \(2^1 = 2\text{ colours}\) (Monochrome)
• \(2\text{ bits per pixel}\): \(2^2 = 4\text{ colours}\) (e.g. Black, White, Red, Blue)
• \(3\text{ bits per pixel}\): \(2^3 = 8\text{ colours}\)
• \(4\text{ bits per pixel}\): \(2^4 = 16\text{ colours}\)
• \(8\text{ bits per pixel}\): \(2^8 = 256\text{ colours}\)
• \(24\text{ bits per pixel}\) (True Colour): \(2^{24} = 16,777,216\text{ colours}\)
What is 24-bit "True Colour"?
Most modern smartphones, cameras, and computer monitors use 24-bit colour. This system is based on the primary colours of light: Red, Green, and Blue (RGB).
• \(8\text{ bits}\) are used for Red (\(0\) to \(255\))
• \(8\text{ bits}\) are used for Green (\(0\) to \(255\))
• \(8\text{ bits}\) are used for Blue (\(0\) to \(255\))
• Total = \(8 + 8 + 8 = 24\text{ bits per pixel}\)
With over \(16.7\text{ million}\) colours available, digital photos look completely natural and lifelike to the human eye!
Key Takeaway: Higher colour depth means more realistic colours, but each pixel takes up more bits of storage.
---3. Image Resolution and Dimensions
Understanding Resolution
At Key Stage 3, resolution refers to the total number of pixels that make up a bitmap image. It is written as:
\(\text{Width (in pixels)} \times \text{Height (in pixels)}\)
For example, an image with a resolution of \(100 \times 100\text{ pixels}\) contains \(10,000\text{ pixels}\) in total.
Display and Print Density
Resolution can also describe how tightly packed the pixels are on a screen or piece of paper, measured in PPI (pixels per inch) or DPI (dots per inch).
The Resolution Trade-off
• Higher Resolution: More pixels in the image \(\implies\) Sharper, clearer, and more detailed image \(\implies\) Larger file size.
• Lower Resolution: Fewer pixels in the image \(\implies\) Less detail, can look blocky or blurry \(\implies\) Smaller file size.
Key Takeaway: Resolution is the size of the pixel grid (\(\text{width} \times \text{height}\)). More pixels mean better quality, but bigger files.
---4. Calculating File Size for Bitmap Images
Calculating the raw file size of an uncompressed image is easy when you follow these simple steps.
The Master Formula
\(\text{File Size (in bits)} = \text{Width (pixels)} \times \text{Height (pixels)} \times \text{Colour Depth (bits)}\)
Converting Bits to Bytes
Because file sizes in bits are usually very large numbers, we convert them into Bytes, Kilobytes (KB), or Megabytes (MB):
• \(1\text{ Byte (B)} = 8\text{ bits (b)}\)
• \(\text{File Size (Bytes)} = \frac{\text{File Size in bits}}{8}\)
• \(1\text{ Kilobyte (KB)} = 1,000\text{ Bytes}\) (or \(1,024\text{ Bytes}\))
• \(1\text{ Megabyte (MB)} = 1,000\text{ KB}\)
Worked Example
Question: Calculate the file size in Bytes for an image that is \(10\text{ pixels}\) wide, \(20\text{ pixels}\) high, and has a colour depth of \(4\text{ bits}\).
Step 1: Find the total number of pixels
\(\text{Total pixels} = 10 \times 20 = 200\text{ pixels}\)
Step 2: Multiply by the colour depth to get bits
\(\text{File size in bits} = 200 \times 4\text{ bits} = 800\text{ bits}\)
Step 3: Convert bits to Bytes (divide by \(8\))
\(\text{File size in Bytes} = \frac{800}{8} = 100\text{ Bytes}\)
Key Takeaway: Multiply \(\text{width} \times \text{height} \times \text{colour depth}\) to get bits, then divide by \(8\) to get Bytes!
---5. Metadata: Data About Data
What is Metadata?
Imagine you receive a long string of binary numbers like \(0110010101...\). Without instructions, your computer would have no idea how wide or high the image is, or how many bits belong to each pixel! It wouldn't know where one row of pixels ends and the next begins.
Metadata is extra information saved inside the image file alongside the raw pixel data that tells the computer how to reconstruct and display the picture properly.
What Does Metadata Include?
• Image Dimensions: The width and height in pixels (e.g. \(1920 \times 1080\))
• Colour Depth: Bits per pixel (e.g. \(24\text{ bits}\))
• Resolution / DPI: For printing and displaying correctly
• File Format: How the data is encoded
• EXIF Data: Date and time taken, camera device details, and GPS location
Key Takeaway: Metadata is the "instruction manual" stored inside an image file so software knows how to draw the pixels on screen.
---6. Bitmap vs Vector Graphics
Not all computer pictures are made of pixel grids. Another important type of digital graphic is a vector graphic.
Vector Graphics: Shapes and Maths
• How they work: Instead of storing individual pixels, vector graphics are made of geometric shapes, lines, curves, and points defined by mathematical formulas and properties (such as start/end coordinates, line thickness, fill colour, and radius).
• Scalability: Vectors are infinitely scalable. You can zoom in or enlarge them as much as you like, and they will never get blurry or blocky because the computer simply recalculates the maths!
• Best used for: Logos, icons, typography/fonts, diagrams, and cartoon illustrations.
Bitmap Graphics: Grids of Pixels
• How they work: Built from a fixed grid of individual pixels.
• Scalability: If you zoom in or enlarge a bitmap, it suffers from pixelation (the individual square pixels become visible and curved edges look jagged and blocky).
• Best used for: Complex, detailed, and continuous-tone images like digital photographs.
Summary Comparison:
• Photographs from a camera \(\implies\) Bitmap (lots of colour variations, made of pixels)
• Company logo on a billboard and business card \(\implies\) Vector (needs to scale to any size without losing sharpness)
Key Takeaway: Bitmaps use grids of pixels (great for photos, but pixelate when enlarged). Vectors use mathematical formulas (great for logos, perfectly sharp at any size).
---7. Common Pitfalls and Revision Tips
Don't Fall into These Traps!
Trap 1: Confusing "bits per pixel" with the "number of colours"
Wrong: "A colour depth of \(4\text{ bits}\) means there are \(4\) colours."
Right: The number of colours is \(2^n\). So a colour depth of \(4\text{ bits}\) gives \(2^4 = 16\text{ colours}\)!
Trap 2: Forgetting to divide by \(8\) when calculating Bytes
Remember: The formula \(\text{Width} \times \text{Height} \times \text{Colour Depth}\) gives you the answer in bits. If an exam question asks for Bytes, always divide your answer by \(8\).
Trap 3: Thinking vector images pixelate when enlarged
Remember: Only bitmap images pixelate when enlarged. Vectors recalculate their mathematical paths to stay crystal clear.
Quick Chapter Summary Checklist
• A pixel is the smallest dot in a bitmap image.
• Colour depth is the number of bits per pixel (\(\text{Colours} = 2^n\)).
• Resolution is the dimensions of the pixel grid (\(\text{Width} \times \text{Height}\)).
• File size in bits = \(\text{Width} \times \text{Height} \times \text{Colour Depth}\).
• Metadata is data about data that tells the computer how to render the image.
• Bitmaps are pixel grids for photos; Vectors are mathematical shapes that scale without losing quality.