Characters
- A character set gives each character a binary code. ASCII uses 7 bits, giving 128 characters (extended ASCII uses 8 bits for 256). Unicode uses up to 32 bits, so it can represent characters from every language, and emoji.
- The codes are in order: if 'A' is 65, then 'C' is 67. The lower-case letters come later ('a' is 97).
Images
- A bitmap image is made of pixels. Each pixel's colour is stored as a binary code.
- Colour depth is the number of bits per pixel. n bits give 2ⁿ colours: 1 bit gives 2 colours, and 8 bits give 256.
- Resolution is the number of pixels in the image (width × height). More pixels or a greater colour depth give better quality, but a bigger file.
- File size in bits = width × height × colour depth. A 100 × 50 image with 8-bit colour is 100 × 50 × 8 = 40 000 bits = 5000 bytes. The file also stores metadata, such as the width, height and colour depth.
Sound
- Sound is sampled: the amplitude of the sound wave is measured at regular intervals and each measurement is stored in binary.
- The sample rate is the number of samples per second, in hertz (Hz). The bit depth (sample resolution) is the number of bits per sample.
- File size in bits = sample rate × bit depth × length in seconds. 10 seconds at 44 100 Hz and 16 bits is 7 056 000 bits = 882 000 bytes.
- A higher sample rate or bit depth makes the recording closer to the original sound, but the file is bigger.
Key terms
- Character set
- A list of characters and the binary code that represents each one.
- ASCII
- A character set that uses 7 bits to represent 128 characters.
- Unicode
- A character set that uses more bits, so it can represent characters from every language.
- Pixel
- A single dot of colour in a bitmap image.
- Colour depth
- The number of bits used to store the colour of each pixel.
- Resolution
- The number of pixels in an image.
- Metadata
- Data about a file, such as an image's width, height and colour depth.
- Sample rate
- The number of sound samples taken per second.
- Bit depth
- The number of bits used to store each sound sample.
Quick questions on Representing text, images and sound
- How many characters can 7-bit ASCII represent?
- 128: 2⁷ = 128.
- Why was Unicode introduced?
- To represent characters from all the world's languages: ASCII only has room for English letters and symbols.
- In ASCII, 'A' is 65. What is 'D'?
- 68: The letters are in order: A 65, B 66, C 67, D 68.
- What is a pixel?
- A single dot of colour in a bitmap image: Images are made of thousands of pixels.
- How many colours can a colour depth of 4 bits show?
- 16: 2⁴ = 16.
- What is colour depth?
- The number of bits used for each pixel: More bits means more possible colours.
- What is the file size of a 100 × 50 pixel image with a colour depth of 8 bits?
- 5000 bytes: 100 × 50 × 8 = 40 000 bits, and 40 000 ÷ 8 = 5000 bytes.
- What happens when the resolution of an image is increased?
- It has more pixels, so more detail and a bigger file: Resolution is the number of pixels.
Representing text, images and sound: questions and answers
- What is metadata in an image file?
- Data about the image, such as its width, height and colour depth. It tells the computer how to display the image.
- What is sampling?
- Measuring the amplitude of a sound wave at regular intervals. Each measurement is stored as a binary number.
- What is the sample rate?
- The number of samples taken per second. It is measured in hertz (Hz).