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.