Year 7 · Summer 2
Raid: Code for a Cause · Lesson 2 of 5
Image editing: cropping, layers and file formats
PracticalTopic 5 Representing images
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
You will learn to
- Use cropping and layers to edit a photo and put text on top.
- Explain the difference between a bitmap image and a vector image.
- Compare the file size of the same image saved as PNG and as JPEG.
- Calculate the size of an image before compression, from its width, height and colour depth.
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Success criteria
You have got it when you can say:
- I can crop a photo and add a text layer over it.
- I can say when to use JPEG, PNG or GIF.
- I can work out an image's size in bits and bytes with the formula.
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
An email link says 'brightwell.example' but hovering shows 'brightwe11-login.xyz'. This is…
A A red flag: the real address is differentB Normal for banksC Safe because it has HTTPS
A. A red flag: the real address is different
- Last unit
Which loop always runs at least once?
A WHILE … ENDWHILEB FOR i ← 1 TO 0C REPEAT … UNTIL
C. REPEAT … UNTIL
- Earlier this year
A shop keeping your data for 20 years 'just in case' breaks…
A Data protection lawB The Computer Misuse Act
A. Data protection law
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Key words (1 of 2)
- colour depth
- Bits per pixel. Sets how many colours are possible.
- Pixel
- The smallest single-colour dot of an image.
- Bitmap
- An image stored as a grid of pixels.
- Resolution
- Number of pixels: width × height.
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Key words (2 of 2)
- Metadata
- Data about data, like an image's width and height.
- Vector
- An image stored as shapes and instructions.
The explanation · step 1 of 3
The simplest image: black and white
If a pixel is only black or white, 1 bit is enough: 1 = black, 0 = white. A 5 × 5 letter T:
1 1 1 1 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0
Stored row after row: 25 bits. The computer also needs to know the width (5) to rebuild the rows.
The explanation · step 2 of 3
More colours = more bits per pixel
Bits per pixel = colour depth. Same rule as before: n bits give 2ⁿ colours.
| Colour depth | Colours | Use |
|---|---|---|
| 1 bit | 2 | Black and white |
| 2 bits | 4 | Very early games |
| 8 bits | 256 | GIFs, retro graphics |
| 24 bits | about 16.7 million | Normal photos |
The explanation · step 2 of 3
The maths: How many colours?
The explanation · step 3 of 3
The maths: Image file size
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Try it: Paint pixels
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Quick quiz · 1 of 3
width × height × colour depth gives the size in…
- A bits
- B KB
- C bytes
A. bits
Each pixel needs d bits. Divide by 8 for bytes.
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Quick quiz · 2 of 3
Which is metadata?
- A A pixel's red value
- B The image's width
- C The colour of pixel 7
B. The image's width
Width, height and colour depth describe the data. They aren't pixels themselves.
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Quick quiz · 3 of 3
A logo must look sharp on a pen and on a billboard. Best stored as…
- A A vector
- B A bitmap
A. A vector
Vectors are redrawn from shapes, so they're sharp at any size.
Year 7 · Raid: Code for a Cause · Lesson 2 of 5
Exit ticket
Answer on paper before you go. Then check.
A 2-bit colour depth gives how many colours?
A 2B 8C 4
C. 4 2 × 2 = 4.
Double the width and the height. The file becomes…
A 2 times biggerB 4 times bigger
B. 4 times bigger 2 × 2 = 4 times the pixels.