Learning Objectives
By the end of this lesson, you will be able to:
- Understand how and why a computer representstextand the use of character sets, includingASCIIandUnicode
- Understand how and why a computer representssound, including the effects of thesample rateandsample resolution
- Understand how and why a computer represents animage, including the effects of theresolutionandcolour depth
- Calculate thefile sizeof text, sound and bitmap image files
- Comparebitmap imageswithvector graphicsand justify which to use for a given task
- Understand the role of thefile headerin bitmap and vector files
- Understandfile compressionand how it can reduce file sizes
Key Terms
Character Set
All the characters and symbols that can be represented by a computer system. Each character is given a unique binary code.
ASCII
American Standard Code for Information Interchange. A 7-bit character set representing 128 characters (extended to 8-bit for 256).
Extended ASCII
An 8-bit character set representing 256 characters. Useful for European languages (é, ©, etc.).
Unicode
A character set using between 8 and 32 bits per character. Represents characters from all languages, including emojis.
Analogue Data
Data obtained by measurement of a physical property which can have any value from a continuous range.
Digital Data
Data stored as a binary value which can have one of a discrete (limited) range of values.
Analogue to Digital Converter (ADC)
A device that converts analogue data (like sound waves) into digital data (binary).
Sampling
Taking measurements of an analogue signal at regular time intervals and storing the values as binary.
Sample Rate
The number of samples taken per second. Measured in Hertz (Hz).
Sample Resolution
The number of bits used to store each sample. Also called bit depth.
Nyquist's Theorem
Sampling must be done at a frequency at least twice the highest frequency of the sound being sampled.
Pixel
Picture element — the smallest identifiable component of a bitmap image. Defined by its position and colour.
Bitmap Image
An image made up of a two-dimensional matrix of pixels. Also called a pixelmap or raster graphic.
Image Resolution
The number of pixels in a bitmap file, defined as the product of width and height (in pixels).
Screen Resolution
The product of width and height values for the number of pixels that a screen can display.
Colour Depth
The number of bits used to represent one pixel in a bitmap image. Higher depth = more colours.
Bit Depth
The number of bits used to store each of the red, green and blue primary colours in RGB colour.
True Colour
24-bit colour (3 bytes per pixel), giving more than 16 million colours.
Vector Graphic
An image created using a sequence of commands or mathematical statements that place lines and shapes in 2D or 3D space.
Drawing List
Part of a vector graphic file header. Contains commands for each object, attributes/properties, and relative positions.
File Header
A set of bytes at the beginning of a file that identifies the file type and contains information about the coding used.
Lossless Compression
Compression where the original data can be perfectly reconstructed (e.g. using a data dictionary).
1. Character Sets: ASCII and Unicode
Text is converted to binary to be processed by a computer. Characters are encoded with the use ofcharacter sets— a group of codes that assign a character to a unique bit pattern.
What is a Character Set?
- A character set isall the characters and symbolsthat can be represented by a computer system.
- Each character is given aunique binary code.
- Character sets are orderedlogically— the code for 'B' is one more than the code for 'A'.
- A character set provides astandardfor computers to communicate and send/receive information.
- Without a character set, one system might interpret01000001differently from another.
- The number of characters that can be represented is determined by the number ofbitsused by the character set.
Two Common Character Sets
ASCII
American Standard Code for Information Interchange. Originally 7-bit (128 characters), extended to 8-bit (256 characters).
Unicode
Universal Character Encoding. Uses 8 to 32 bits per character, representing characters from all languages worldwide.
ASCII Reference Table (selected values)
| Character | Denary | Binary | Hex | Character | Denary | Binary | Hex |
|---|---|---|---|---|---|---|---|
| A | 65 | 01000001 | 41 | a | 97 | 01100001 | 61 |
| B | 66 | 01000010 | 42 | b | 98 | 01100010 | 62 |
| C | 67 | 01000011 | 43 | c | 99 | 01100011 | 63 |
| N | 78 | 01001110 | 4E | n | 110 | 01101110 | 6E |
| O | 79 | 01001111 | 4F | o | 111 | 01101111 | 6F |
| P | 80 | 01010000 | 50 | p | 112 | 01110000 | 70 |
| Q | 81 | 01010001 | 51 | q | 113 | 01110001 | 71 |
| R | 82 | 01010010 | 52 | r | 114 | 01110010 | 72 |
| Space | 32 | 00100000 | 20 | ! | 33 | 00100001 | 21 |
ASCII Details
- 7-bit set— 2⁷ = 128 different characters.
- Enough for every upper-case letter, lower-case letter, digit and punctuation mark on most keyboards.
- Only used for the English language.
- Extended ASCIIis an 8-bit set — 2⁸ = 256 characters.
- Extended ASCII makes it possible to use characters such aséor©.
- Useful forEuropean languages.
Unicode Details
- Uses between8 and 32 bits per character.
- Can represent characters fromlanguages all around the world.
- Commonly used across theinternet.
- Can representspecial characterssuch as emojis.
- As it is larger than ASCII, it might take upmore storage space.
- Global companies like Facebook and Google use Unicode because their users communicate in many different languages.
| Feature | ASCII | Unicode |
|---|---|---|
| Number of characters | 128 (7-bit) or 256 (8-bit extended) | Over 1.1 million |
| Uses | Represent characters in the English language | Represent characters across the world |
| Benefits | Uses a lot less storage space than Unicode | Can represent more characters; supports all common characters worldwide; can represent special characters such as emojis |
| Drawbacks | Can only represent 128/256 characters; cannot store emojis | Uses a lot more storage space than ASCII |
Real-Life Example: Why Facebook uses Unicode
Facebook has users all over the world who write in English, Arabic, Chinese, Hindi, Spanish, and many other languages. If Facebook used ASCII, it could only display English characters. A user typing in Chinese would see errors or blank boxes.
Unicode allows Facebook to store and display text inany language, including emojis like 😀 🎉 🚀.
Activity 1: ASCII vs Unicode
A company is developing a new messaging app. The app will be used by people all over the world who speak different languages.
- Recommend which character set the company should use. Justify your answer. [3]
- State one drawback of using this character set. [1]
- Explain why ASCII would not be suitable for this app. [2]
Solution:
- The company should useUnicode[1]. It can represent characters from all languages around the world [1], and can represent special characters such as emojis which are common in messaging apps [1].
- Unicode usesmore storage spacethan ASCII [1].
- ASCII can only representEnglish characters[1]. Users writing in other languages (e.g. Chinese, Arabic, Hindi) would not be able to use the app correctly [1].
Check Your Understanding: Character Sets
1. How many characters can standard ASCII represent? [1 mark]
- [1]128 characters (7-bit, 2⁷)
2. What is the main advantage of Unicode over ASCII? [2 marks]
- [1]Unicode can represent characters from all languages around the world
- [1]It can also represent special characters such as emojis
3. Why is a character set needed for computers to communicate? [2 marks]
- [1]Without a standard, one system might interpret a binary code differently from another
- [1]A character set assigns a unique binary code to each character, allowing computers to send and receive text correctly
4. The ASCII denary code 76 represents which character? [1 mark]
- [1]L (must be a capital letter, since ASCII codes 65–90 are A–Z)
5. What is Extended ASCII and why was it developed? [2 marks]
- [1]Extended ASCII is an 8-bit character set that represents 256 characters
- [1]It was developed to allow characters used in European languages (such as é or ©) to be represented
6. A student says "ASCII and Unicode are the same thing." Explain why this is incorrect. [2 marks]
- [1]ASCII uses 7 or 8 bits and can represent a maximum of 256 characters, only for English and some European languages
- [1]Unicode uses between 8 and 32 bits and can represent over 1.1 million characters from all languages, including emojis
2. Representing Text in Binary & Text File Size
Text and numbers can be stored in a number of formats. Text is usually stored in anASCII format. If ASCII format is used to store text on a file, then the ASCII table is used to store each of the characters.
Storing Text: Example
The wordCOMPUTERwould be stored as:
Each character is stored as one byte (8 bits).
Estimating Text File Size
- Each character from the keyboard has a value of1 byte.
- To estimate the file size, simplycount the number of characters(including spaces).
- Example: "This is text from the computer science text book" = 48 characters =48 bytes.
File Compression (Lossless)
Text files can undergofile compression. These use complex algorithms that work onredundancyor repeated sections of words.
This is an example oflossless compressionbecause the original phrase can be perfectly reconstructed using the data dictionary and compressed file.
Activity 2: Text File Size
A text file contains the following message:"Hello World! This is Computer Science."
- Estimate the file size in bytes if stored using ASCII. [1]
- The file is compressed using a data dictionary. The word "Science" is replaced by "1" and "Computer" by "2". What is the new approximate file size? [2]
- Explain why this is an example of lossless compression. [2]
Solution:
- The message has 39 characters (including spaces and punctuation) →39 bytes. [1]
- Original: 39 bytes. "Computer" (8 chars) → "2" (1 char), saving 7 bytes. "Science" (7 chars) → "1" (1 char), saving 6 bytes. New size = 39 − 7 − 6 =26 bytes. [2]
- It islosslessbecause the original text can be perfectly reconstructed [1] using the data dictionary to replace "1" with "Science" and "2" with "Computer" [1].
Check Your Understanding: Text Representation
1. How many bytes are needed to store the word "Hello"? [1 mark]
- [1]5 bytes (one byte per character)
2. What denary value is used to store the letter 'A' in ASCII? [1 mark]
- [1]65
3. Explain how file compression can reduce the size of a text file. [2 marks]
- [1]It identifies repeated words or sections of words
- [1]It replaces them with shorter codes stored in a data dictionary, reducing the number of memory units needed
4. What is the hexadecimal value for the character 'P' in ASCII? [2 marks]
- [1]Denary value of 'P' is 80
- [1]80 in hex = 50
5. A text file contains 150 characters. Estimate its size in bytes and in KiB. [2 marks]
- [1]150 bytes
- [1]150 ÷ 1024 ≈ 0.146 KiB
6. Explain why a text file stored in Unicode is larger than the same file stored in ASCII. [2 marks]
- [1]Unicode uses between 8 and 32 bits per character, while ASCII uses 7 or 8 bits
- [1]Therefore each character in a Unicode file requires more storage space than in an ASCII file
3. Representing Sound: Sampling
Sound is ananaloguevalue; this needs to bedigitisedin order to store sound in a computer. This is done using ananalogue to digital converter (ADC).
How Sound is Sampled & Stored
- Measurements of the original sound wave are captured and stored as binary on secondary storage.
- Sound waves begin asanalogue.
- For a computer system to understand them, they must be converted into adigitalform.
- This process is calledAnalogue to Digital conversion (A2D).
- The process begins by measuring theamplitudeof the analogue sound wave at a point in time — calledsamples.
- Each measurement generates a value which can be represented in binary and stored.
- Using the samples, a computer is able to create a digital version of the original analogue wave.
- The digital wave is stored on secondary storage and can be played back at any time by reversing the process.
Sound Encoder
Measured sound values are input to asound encoderwhich has two components:
- Band-limiting filter— removes high frequency components. A human ear cannot detect these very high frequencies, and they could cause problems for coding if not removed.
- Analogue-to-digital converter (ADC)— converts analogue data to digital data.
Understanding Amplitude and Frequency
Amplitude
The amplitude of a sound wave is the measure of the height of the wave. It represents theloudness (volume)of the sound. It is measured in decibels (dB). A larger amplitude = louder sound.
Frequency and Bandwidth
Frequency is the number of complete cycles per unit time (measured in Hz).Bandwidthis a range of frequencies within a continuous set of frequencies. Higher frequency = higher pitch.
Sample Rate & Sample Resolution
Sample Rate
- Thenumber of samples taken per second.
- Measured inHertz (Hz).
- 1 Hertz = 1 sample of the sound wave per second.
- Thehigherthe sample rate, the closer the digital wave is to the original analogue wave.
- Higher sample rate =greater file size.
- Typical audio CD:44.1 kHz(44,100 samples per second).
- Telephone: 16/22 kHz. DVD: 48 kHz.
Sample Resolution (Bit Depth)
- Thenumber of bits stored per sample.
- Related to thecolour depthof a bitmap image — they measure the same thing in different contexts.
- Thehigherthe sample resolution, the more accurate the digitised sound.
- Larger sampling resolution means asmaller quantisation errorand less distortion.
- Higher sample resolution =greater file size.
- 16-bit sampling resolution is used when recording CDs.
Nyquist's Theorem
Sampling rate should be in accordance withNyquist's theorem, which states that sampling must be done at a frequencyat least twicethe highest frequency of the sound being sampled. This ensures the original sound can be accurately reconstructed.
| Sample Rate | Sample Resolution | Playback Quality | File Size |
|---|---|---|---|
| High | High | Best | Largest |
| High | Low | Good | Large |
| Low | High | Fair | Smaller |
| Low | Low | Poorest | Smallest |
Pros and Cons of Larger Sampling Resolution
Benefits
- Larger dynamic range
- Better sound quality
- Less sound distortion
Drawbacks
- Produces larger file size
- Takes longer to transmit/download music files
- Requires greater processing power
Features of Sound Editor Software
- Edit the start/stop times and duration of a sample
- Extract and save (or delete) part of a sample
- Alter the frequency and amplitude of a sample
- Fade in and fade out
- Mix and/or merge multiple sound tracks or sources
- Combine various sound sources together and alter their properties
- Remove 'noise' to enhance one sound wave in a multiple of waves
- Convert between different audio formats
Interactive Sound Sampling Visualisation
Adjust the sample rate and sample resolution to see how the digital wave changes.
Higher sample rate= more points measured per second = more accurate representation.Higher sample resolution= more possible amplitude values = smoother steps.
Activity 3: Sound File Size Calculations
Show all working for each calculation.
- An audio CD has a sample rate of 44,100 Hz and a sample resolution of 16 bits. The music uses two channels (stereo). Calculate the file size for a 60-minute recording. Give your answer in MiB. [4]
- A voice recording is sampled at 8,000 Hz with a resolution of 8 bits. Calculate the file size of a 30-second mono recording in bytes. [2]
- Explain why the voice recording from part (b) has a lower quality than the audio CD in part (a). [2]
Solution:
- File size = sample rate × sample resolution × length × channels= 44,100 × 16 × (60 × 60) × 2 = 5,080,320,000 bits= 5,080,320,000 ÷ 8 = 635,040,000 bytes= 635,040,000 ÷ (1024 × 1024) ≈605 MiB
- File size = 8,000 × 8 × 30 = 1,920,000 bits= 1,920,000 ÷ 8 =240,000 bytes
- The voice recording has a muchlower sample rate(8,000 Hz vs 44,100 Hz) and alower sample resolution(8 bits vs 16 bits) [1].This means fewer measurements are taken and each measurement is less precise, so the digital wave is a less accurate representation of the original analogue sound [1].
Check Your Understanding: Sound
1. Why must sound be converted to binary before a computer can store it? [2 marks]
- [1]Sound is an analogue signal — it varies continuously
- [1]Computers can only process and store digital (binary) data, so the analogue sound must be sampled and converted using an ADC
2. What is sample rate and what is it measured in? [2 marks]
- [1]Sample rate is the number of samples taken per second of the analogue wave
- [1]It is measured in Hertz (Hz)
3. What effect does increasing the sample rate have on file size and quality? [2 marks]
- [1]Increasing the sample rate increases the file size
- [1]It also improves the accuracy/quality of the digitised sound
4. State Nyquist's theorem. [2 marks]
- [1]Sampling must be done at a frequency
- [1]at least twice the highest frequency of the sound being sampled
5. A mono sound file is recorded at 22,050 Hz with a resolution of 8 bits for 10 seconds. Calculate the file size in bytes. [2 marks]
- [1]22,050 × 8 × 10 = 1,764,000 bits
- [1]1,764,000 ÷ 8 = 220,500 bytes
6. What is the purpose of the band-limiting filter in a sound encoder? [2 marks]
- [1]It removes high frequency components from the sound
- [1]Humans cannot hear these frequencies, and they could cause problems for coding if not removed
4. Representing Images: Bitmap Images
Abitmap imageis made up of squares calledpixels(picture elements). The image is stored in a two-dimensional matrix of pixels.
Bitmap Images
- Made up ofpixels— the smallest identifiable component of a bitmap image.
- Each pixel is defined by just two properties: itspositionin the bitmap matrix and itscolour.
- Each pixel is stored as abinary code— binary codes are unique to the colour in each pixel.
- Bitmaps are also known aspixelmapsorraster graphics.
- Widely used on digital cameras, smartphones, and online.
- A typical example of a bitmap image is aphotograph.
Colour Depth
- Thenumber of bits used to represent one pixel.
- A colour depth of 8 bits per pixel provides256 different colours(2⁸).
- True colour requires3 bytes per pixel (24 bits)— more than 16 million colours.
- When colour depth increases, the number of possible colours also increases.
- If a lower bit depth is used, the image will showbands of colour.
- Bit depthis the number of bits used to store each of the red, green and blue primary colours in RGB colour.
Colour Depth and Number of Colours
| Colour Depth | Amount of Colours | Example Use |
|---|---|---|
| 1 bit | 2 (black and white) | Simple monochrome images |
| 2 bits | 4 | Early computer graphics |
| 4 bits | 16 | Simple greyscale / retro games |
| 8 bits | 256 | Coloured image with 256 colours |
| 24 bits | 16,777,216 (True Colour) | Photographs, modern displays |
Image Resolution
- Thenumber of pixels in a bitmap file.
- Defined as the product ofwidth × height.
- Example: an image could contain 4096 × 3192 pixels (12,738,656 pixels in total).
- In general, the higher the resolution, the more detail in the image (higher quality).
Screen Resolution
- The number of horizontal pixels and vertical pixels that make up a screen display.
- Example: Computer monitors — 1440p means 1440 pixels horizontally. 4K is 3840 pixels.
- HD TVs have a resolution of 1080p; UHD has 3840 pixels (4K).
- If screen resolution is smaller than image resolution, the whole image cannot be shown on the screen or the original image will be a lower quality.
Why Bitmap Images Become Poor Quality When Zoomed In
Bitmap images are organized as a grid of coloured squares called pixels. When zooming in or enlarging a bitmap image, pixels arestretched and made into larger blocks. This is why bitmap images appear blocky and "pixelated" when enlarged too much. The number of pixels in the image does not change when it is scaled.
Interactive Pixel Grid Visualisation
Adjust the grid size and colour depth to see how the image quality changes.
Higher resolution(more pixels) = more detail, larger file.Higher colour depth= more colours, larger file.
Activity 4: Bitmap Image Concepts
- Define the termpixel. [1]
- If an image has a colour depth of 2 bits, how many colours can the image represent? [1]
- Describe the impact of changing an image's resolution from 500 × 500 to 1000 × 1000. [2]
- Explain why a bitmap image becomes "pixelated" when enlarged. [2]
Solution:
- The smallest element of a bitmap image (1 square). [1]
- 4 colours (2² = 4). [1]
- The image quality would be higher [1] and the file size would be larger [1].
- Bitmap images are organized as a grid of coloured squares called pixels. When zooming in, pixels are stretched and made into larger blocks [1]. The number of pixels in the image does not change, so the image appears blocky and pixelated [1].
Check Your Understanding: Bitmap Images
1. What is a pixel? [1 mark]
- [1]The smallest element of a bitmap image — a single square/dot defined by its position and colour
2. How many colours can be represented with a colour depth of 4 bits? [1 mark]
- [1]16 colours (2⁴ = 16)
3. Define image resolution. [1 mark]
- [1]The number of pixels in a bitmap file, defined as the product of width and height
4. What happens if the screen resolution is smaller than the image resolution? [2 marks]
- [1]The whole image cannot be shown on the screen
- [1]Or the original image will be displayed at a lower quality
5. What is true colour and how many bits does it use? [2 marks]
- [1]True colour uses 24 bits per pixel (3 bytes)
- [1]It gives more than 16 million colours (2²⁴ = 16,777,216)
6. Explain how changing the colour depth affects the file size of a bitmap image. [2 marks]
- [1]Increasing the colour depth increases the number of bits stored per pixel
- [1]This increases the total file size of the image
5. Calculating Bitmap File Sizes
Formula
For a mono sound file:sample rate × sample resolution × length.
For stereo sound, multiply the result by 2.
Example 1: Full Screen Image
Example 2: Camera Detector
Example 3: How Many Photos Fit?
Example 4: DPI Calculation
Bitmap File Header
A set of bytes at the beginning of a bitmap file which identifies the file type and contains information about the coding used.
- Definescolour depthor bit depth andimage resolutionof the image.
- Contains information about the type ofcompressionused and dimensions of the image (e.g. 100 × 100 pixels).
- A bitmap file stores pixel data that defines the graphicanda file header — this is why the file is larger than the size of the graphic alone.
- When saving a bitmap image, it is important to include a file header; this will contain items such as file type (.bmp or .jpeg), file size, image resolution, bit depth (usually 1, 8, 16, 24 or 32), any type of data compression employed, and so on.
Activity 5: Bitmap File Size Calculations
- A photograph has a bit depth of 8 bytes and image resolution of 1500 pixels wide and 3000 pixels high. Calculate the file size in megabytes (MB). [3]
- A camera detector has an array of 1920 × 1536 pixels. A colour depth of 16 bits is used. Calculate the size of the photograph in MiB. [3]
- A smartphone has a 1024 × 1536 pixel detector and uses 24-bit colour. How many photographs could be stored on a 16 GiB memory card? [4]
Solution:
- Total pixels = 1500 × 3000 = 4,500,000Image size = (4,500,000 × 8) ÷ 1,000 ÷ 1,000 =36 MB
- 1920 × 1536 = 2,949,120 pixels× 16 = 47,185,920 bits÷ 8 = 5,898,240 bytes÷ (1024 × 1024) =5.625 MiB
- 1024 × 1536 = 1,572,864 pixels× 24 = 37,748,736 bits÷ 8 = 4,718,592 bytes16 GiB = 17,179,869,184 bytes17,179,869,184 ÷ 4,718,592 ≈3,640 photos
Check Your Understanding: Bitmap File Size
1. What is the formula for calculating the file size of a bitmap image? [2 marks]
- [1]File size = image resolution × colour depth
- [1](in pixels) × (in bits) — then divide by 8 to get bytes
2. A bitmap is 800 × 600 pixels with a colour depth of 24 bits. Calculate the file size in bytes. [2 marks]
- [1]800 × 600 × 24 = 11,520,000 bits
- [1]11,520,000 ÷ 8 = 1,440,000 bytes
3. What information is stored in a bitmap file header? [3 marks]
- [1]File type (e.g. .bmp or .jpeg) and file size
- [1]Image resolution and colour depth / bit depth
- [1]Any type of data compression employed
4. A photograph is 1024 × 1080 pixels with a colour depth of 32 bits. Calculate the file size in MiB. [3 marks]
- [1]1024 × 1080 = 1,105,920 pixels
- [1]× 32 = 35,389,440 bits ÷ 8 = 4,423,680 bytes
- [1]÷ (1024 × 1024) ≈ 4.22 MiB
5. Why is a bitmap file larger than the size of the graphic alone? [2 marks]
- [1]A bitmap file stores pixel data that defines the graphic
- [1]It also has a file header that contains information on how the graphic has been constructed (resolution, colour depth, compression, etc.)
6. A camera has 2048 × 2048 pixels and uses 16-bit colour. Calculate the image size in MiB. [3 marks]
- [1]2048 × 2048 = 4,194,304 pixels
- [1]× 16 = 67,108,864 bits ÷ 8 = 8,388,608 bytes
- [1]÷ (1024 × 1024) = 8 MiB
6. Vector Graphics
Avector graphicuses scalable shapes such as straight lines and curves, using coordinates and geometry to precisely define the parts of the image.
Vector Graphic Components
- Created usingcomputer aided design (CAD)software or an application that uses a drawing canvas.
- Contains adrawing list(included in the file header) made up of:
- Thecommandused for each object that makes up the graphic image
- Theattributesthat define the properties of each object
- Therelative positionof each object
- Dimensions of each object are not defined, but relative positions are — this meansscaling up will result in no loss of quality.
- A vector graphic file will have asmaller sizethan a corresponding bitmap file.
Displaying Vector Graphics
- Whenever the image is to be displayed, the file is read, appropriate calculations are made, and objects are drawn to a suitable scale.
- If the user requests the image to be redrawn at a larger scale, the file is read again and another set of calculations is made before the image is displayed.
- This avoids image distortion, such as the image appearing squashed or stretched.
- Vector graphic files can only be displayed directly on agraph plotter(an expensive specialised piece of hardware).
- For the image to appear correctly on other types of display, the file often has to be converted to abitmap.
- If a vector graphic needs to be printed using a laser or inkjet printer, it must first be converted to a bitmap.
When to Use Vector Graphics
- When designing alogofor a company.
- When composing an'exploded diagram'of a car engine.
- When a diagram is needed for part ofarchitectural, engineering or manufacturing design.
- When the image needs to beresizedwithout loss of quality.
- When the image needs to bedrawn to scale.
When to Use Bitmap Images
- Adigital cameraautomatically produces a bitmap.
- A bitmap file is the choice forinsertion of an imageinto a document, publication or web page.
- When arealisticimage is needed (e.g. a photograph).
Comparison: Vector vs Bitmap
| Vector Graphic Images | Bitmap Images |
|---|---|
| Made up of geometric shapes which require definition/attributes | Made up of tiny pixels of different colours |
| To alter/edit the design, it is necessary to change each of the geometric shapes | Possible to alter/edit each of the pixels to change the design of the image |
| They do not require large file size since they are made up of simple geometric shapes | Because of the use of pixels (which give very accurate designs), the file size is very large |
| Because the number of geometric shapes is limited, vector graphics are not usually very realistic | Since images are built up pixel by pixel, the final image is usually very realistic |
| File formats are usually .svg, .cgm, .odg | File formats are usually .jpeg, .bmp, .png |
Activity 6: Vector vs Bitmap
For each scenario below, decide whether a vector graphic or a bitmap image is more suitable, and justify your choice.
- A company logo that will be printed on business cards, letterheads, and a large billboard.
- A photograph of a family on holiday to be inserted into a digital photo album.
- An architectural diagram of a new house that needs to be scaled to different sizes.
- A screenshot of a web page to include in a textbook.
Solution:
- Vector graphic— it can be scaled to any size (from business card to billboard) without loss of quality.
- Bitmap image— a photograph is naturally a bitmap, as it is made up of pixels and needs to be realistic.
- Vector graphic— it can be scaled to different sizes without loss of quality, and is ideal for precise technical drawings.
- Bitmap image— a screenshot captures the exact appearance of the screen pixel by pixel.
Check Your Understanding: Vector Graphics
1. What is a vector graphic? [2 marks]
- [1]An image created using a sequence of commands or mathematical statements
- [1]That place lines and shapes in a two-dimensional or three-dimensional space
2. What is a drawing list and where is it stored? [2 marks]
- [1]A drawing list contains the commands for each object, the attributes/properties of each object, and the relative position of each object
- [1]It is included in the file header of a vector graphic file
3. Why do vector graphics not lose quality when scaled up? [2 marks]
- [1]Vector graphics store mathematical instructions for drawing shapes, not fixed pixels
- [1]When the image is resized, the commands are re-executed with new calculations, so the shapes remain smooth
4. Give two file formats used for vector graphics and two for bitmap images. [2 marks]
- [1]Vector: .svg, .cgm, .odg (any two)
- [1]Bitmap: .jpeg, .bmp, .png (any two)
5. Why might a vector graphic need to be converted to a bitmap? [2 marks]
- [1]Vector graphics can only be displayed directly on a graph plotter
- [1]To display on a normal screen or print with a laser/inkjet printer, the file must be converted to a bitmap
6. A student says "Vector graphics are always better than bitmap images." Explain why this is not always true. [3 marks]
- [1]Vector graphics are not usually very realistic because the number of geometric shapes is limited
- [1]Bitmap images are built up pixel by pixel, so the final image is usually very realistic (e.g. photographs)
- [1]For tasks like editing photographs or inserting images into documents, a bitmap is the better choice
Key Takeaways
- Character setsassign a unique binary code to each character. Common sets areASCII(7/8-bit, English only) andUnicode(8–32 bits, all languages + emojis).
- ASCIIuses 7 bits (128 characters) or 8 bits in Extended ASCII (256 characters).Unicodecan represent over 1.1 million characters.
- Each character in a text file is stored as1 byte. File size = number of characters.
- Lossless compressionreduces file size by replacing repeated words/sections with shorter codes stored in a data dictionary.
- Soundis analogue and must besampled(measured at regular intervals) and converted using anADC.
- Sample rate= number of samples per second (Hz).Sample resolution= number of bits per sample.
- Higher sample rate and resolution =better qualitybutlarger file size.
- Nyquist's theorem: sample at least twice the highest frequency of the sound.
- Sound file size =sample rate × sample resolution × length. For stereo, multiply by 2.
- Bitmap imagesare made ofpixels. Colour depth = bits per pixel. Higher colour depth = more colours.
- Image resolution= total pixels (width × height).Screen resolution= pixels a screen can display.
- Bitmap file size =image resolution × colour depth. A file header stores metadata about the image.
- Vector graphicsuse mathematical commands/shapes. They scale without loss of quality and have smaller file sizes but are less realistic.
- Vector file formats: .svg, .cgm, .odg. Bitmap file formats: .jpeg, .bmp, .png.
Question Bank
1. Explain the difference between ASCII and Unicode. [4 marks]
- [1]ASCII uses 7 or 8 bits per character; Unicode uses between 8 and 32 bits per character
- [1]ASCII can represent 128 (or 256 extended) characters; Unicode can represent over 1.1 million characters
- [1]ASCII is used for English (and some European languages); Unicode can represent characters from all languages
- [1]Unicode can represent special characters such as emojis; ASCII cannot
2. Describe how sound is represented and encoded in a computer. [4 marks]
- [1]Amplitude of the sound wave is recorded a set number of times a second (sampling)
- [1]Each amplitude measurement is given a corresponding binary value
- [1]The binary value of each sample is stored in sequence
- [1]An ADC (analogue-to-digital converter) is used to convert the analogue signal to digital
3. What is the effect of increasing the sample rate and sample resolution on sound quality and file size? [4 marks]
- [1]Increasing sample rate and/or resolution increases the accuracy of the digitised sound (better quality)
- [1]It reduces distortion / smaller quantisation error
- [1]It also increases the file size
- [1]This means it takes longer to transmit/download and requires more processing power
4. An audio CD has a sample rate of 44,100 Hz and a sample resolution of 16 bits. The music uses two channels. Calculate the file size for a 60-minute recording. [4 marks]
- [1]File size = 44,100 × 16 × (60 × 60) × 2
- [1]= 5,080,320,000 bits
- [1]÷ 8 = 635,040,000 bytes
- [1]÷ (1024 × 1024) ≈ 605 MiB
5. Describe how a bitmap image is represented in a computer. [4 marks]
- [1]A bitmap image is made up of pixels arranged in a two-dimensional matrix
- [1]Each pixel is stored as a binary code
- [1]The colour depth determines the number of bits used per pixel (and therefore the number of colours)
- [1]The image resolution is the total number of pixels (width × height)
6. A photograph has a bit depth of 8 bytes and an image resolution of 1500 pixels wide and 3000 pixels high. Calculate the file size of the photograph in megabytes. [3 marks]
- [1]Total pixels = 1500 × 3000 = 4,500,000
- [1]Image size = 4,500,000 × 8 = 36,000,000 bits
- [1]÷ 1,000 ÷ 1,000 = 36 MB
7. Compare and contrast vector graphics and bitmap images. [6 marks]
- [1]Vector graphics are made of geometric shapes; bitmaps are made of pixels
- [1]Vector graphics can be resized without loss of quality; bitmaps become pixelated when enlarged
- [1]Vector graphics usually have smaller file sizes; bitmap file sizes are larger
- [1]Vector graphics are less realistic; bitmaps produce realistic images (e.g. photographs)
- [1]Vector file formats include .svg, .cgm, .odg; bitmap formats include .jpeg, .bmp, .png
- [1]Vector graphics are edited by changing geometric shapes; bitmaps are edited pixel by pixel
8. Explain what is meant by a file header and why a bitmap file is larger than the size of the graphic alone. [4 marks]
- [1]A file header is a set of bytes at the beginning of a file that identifies the file type
- [1]It contains information about the coding used, e.g. colour depth, image resolution, compression
- [1]A bitmap file stores the pixel data that defines the graphic
- [1]It also stores the file header, which adds extra bytes to the file size
9. A camera detector has an array of 1920 × 1536 pixels. A colour depth of 16 bits is used. Calculate the size of the photograph in MiB. [3 marks]
- [1]1920 × 1536 = 2,949,120 pixels
- [1]× 16 = 47,185,920 bits ÷ 8 = 5,898,240 bytes
- [1]÷ (1024 × 1024) = 5.625 MiB
10. Explain why a text file stored using Unicode might be larger than the same file stored using ASCII. [2 marks]
- [1]Unicode uses between 8 and 32 bits per character, while ASCII uses 7 or 8 bits
- [1]Each character in Unicode takes up more storage space, so the overall file is larger
11. Describe the process of lossless compression with an example. [4 marks]
- [1]Repeated words or sections of words are identified
- [1]They are replaced by shorter codes, stored in a data dictionary
- [1]Example: "THIS SECTION SHOWS YOU HOW THIS WOULD WORK" becomes "1 SECTION S2S Y3 2 1 W3LD WORK" with 1=THIS, 2=HOW, 3=OU
- [1]The original can be perfectly reconstructed using the data dictionary (lossless)
12. What is Nyquist's theorem and why is it important when sampling sound? [3 marks]
- [1]Sampling must be done at a frequency at least twice the highest frequency of the sound
- [1]If the sample rate is too low, high frequencies may be missed or distorted
- [1]Following Nyquist's theorem ensures the original sound can be accurately reconstructed
13. A company is designing a logo that will be used on business cards, letterheads, and a large billboard. Justify whether they should use a vector graphic or a bitmap image. [3 marks]
- [1]A vector graphic should be used
- [1]Vector graphics can be scaled to any size without loss of quality — essential for both small (business card) and large (billboard) applications
- [1]Vector graphics have smaller file sizes, making them easier to store and transmit
14. What is the difference between image resolution and screen resolution? [3 marks]
- [1]Image resolution is the number of pixels in a bitmap file (width × height)
- [1]Screen resolution is the number of horizontal and vertical pixels that make up a screen display
- [1]If screen resolution is smaller than image resolution, the whole image cannot be shown on the screen or the image will be displayed at a lower quality