TSI

1.2 Text, Sound & Images

Understanding character sets, how computers represent sound and images, and how to calculate file sizes.

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)

CharacterDenaryBinaryHexCharacterDenaryBinaryHex
A650100000141a970110000161
B660100001042b980110001062
C670100001143c990110001163
N78010011104En110011011106E
O79010011114Fo111011011116F
P800101000050p1120111000070
Q810101000151q1130111000171
R820101001052r1140111001072
Space320010000020!330010000121

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.
FeatureASCIIUnicode
Number of characters128 (7-bit) or 256 (8-bit extended)Over 1.1 million
UsesRepresent characters in the English languageRepresent characters across the world
BenefitsUses a lot less storage space than UnicodeCan represent more characters; supports all common characters worldwide; can represent special characters such as emojis
DrawbacksCan only represent 128/256 characters; cannot store emojisUses 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.

  1. Recommend which character set the company should use. Justify your answer. [3]
  2. State one drawback of using this character set. [1]
  3. Explain why ASCII would not be suitable for this app. [2]
Solution:
  1. 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].
  2. Unicode usesmore storage spacethan ASCII [1].
  3. 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]128 characters (7-bit, 2⁷)
  • [1]Unicode can represent characters from all languages around the world
  • [1]It can also represent special characters such as emojis
  • [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
  • [1]L (must be a capital letter, since ASCII codes 65–90 are A–Z)
  • [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
  • [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:

Denary:
67 79 77 80 85 84 69 82
Hexadecimal:
43 4F 4D 50 55 54 45 52

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.

Original phrase:
THIS SECTION SHOWS YOU HOW THIS WOULD WORK
Consists of 35 memory units (ignoring spaces).
Data Dictionary:
1 = THIS   2 = HOW   3 = OU
Compressed phrase:
1 SECTION S2S Y3 2 1 W3LD WORK
Compressed form uses only 23 memory units — about a33% savingin file size.

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."

  1. Estimate the file size in bytes if stored using ASCII. [1]
  2. 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]
  3. Explain why this is an example of lossless compression. [2]
Solution:
  1. The message has 39 characters (including spaces and punctuation) →39 bytes. [1]
  2. 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]
  3. 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]5 bytes (one byte per character)
  • [1]65
  • [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
  • [1]Denary value of 'P' is 80
  • [1]80 in hex = 50
  • [1]150 bytes
  • [1]150 ÷ 1024 ≈ 0.146 KiB
  • [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 RateSample ResolutionPlayback QualityFile Size
HighHighBestLargest
HighLowGoodLarge
LowHighFairSmaller
LowLowPoorestSmallest

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.

  1. 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]
  2. 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]
  3. Explain why the voice recording from part (b) has a lower quality than the audio CD in part (a). [2]
Solution:
  1. 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
  2. File size = 8,000 × 8 × 30 = 1,920,000 bits
    = 1,920,000 ÷ 8 =240,000 bytes
  3. 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]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
  • [1]Sample rate is the number of samples taken per second of the analogue wave
  • [1]It is measured in Hertz (Hz)
  • [1]Increasing the sample rate increases the file size
  • [1]It also improves the accuracy/quality of the digitised sound
  • [1]Sampling must be done at a frequency
  • [1]at least twice the highest frequency of the sound being sampled
  • [1]22,050 × 8 × 10 = 1,764,000 bits
  • [1]1,764,000 ÷ 8 = 220,500 bytes
  • [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 DepthAmount of ColoursExample Use
1 bit2 (black and white)Simple monochrome images
2 bits4Early computer graphics
4 bits16Simple greyscale / retro games
8 bits256Coloured image with 256 colours
24 bits16,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

  1. Define the termpixel. [1]
  2. If an image has a colour depth of 2 bits, how many colours can the image represent? [1]
  3. Describe the impact of changing an image's resolution from 500 × 500 to 1000 × 1000. [2]
  4. Explain why a bitmap image becomes "pixelated" when enlarged. [2]
Solution:
  1. The smallest element of a bitmap image (1 square). [1]
  2. 4 colours (2² = 4). [1]
  3. The image quality would be higher [1] and the file size would be larger [1].
  4. 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]The smallest element of a bitmap image — a single square/dot defined by its position and colour
  • [1]16 colours (2⁴ = 16)
  • [1]The number of pixels in a bitmap file, defined as the product of width and height
  • [1]The whole image cannot be shown on the screen
  • [1]Or the original image will be displayed at a lower quality
  • [1]True colour uses 24 bits per pixel (3 bytes)
  • [1]It gives more than 16 million colours (2²⁴ = 16,777,216)
  • [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

File Size = Image Resolution × Colour Depth
(in pixels)              (in bits)

For a mono sound file:sample rate × sample resolution × length.
For stereo sound, multiply the result by 2.

Example 1: Full Screen Image

Resolution: 1920 × 1080 pixels
Bit depth: 24 bits
1920 × 1080 × 24 = 49,766,400 bits
÷ 8 = 6,220,800 bytes
÷ 1024 ÷ 1024 ≈ 5.933 MiB

Example 2: Camera Detector

Array: 2048 × 2048 pixels
Colour depth: 16 bits
2048 × 2048 = 4,194,304 pixels
× 16 = 67,108,864 bits
÷ 8 = 8,388,608 bytes
÷ 1024 ÷ 1024 = 8 MiB

Example 3: How Many Photos Fit?

Photo: 1024 × 1080 pixels, 32-bit colour
Memory stick: 64 GiB
1024 × 1080 = 1,105,920 pixels
× 32 = 35,389,440 bits
÷ 8 = 4,423,680 bytes
64 GiB = 68,719,476,736 bytes
68,719,476,736 ÷ 4,423,680 ≈ 15,534 photos

Example 4: DPI Calculation

Bitmap: bit depth 8, 72 dpi, 5 inches × 3 inches
Bit depth 8 per RGB component = 24 bits per pixel
Pixels per row: 5 × 72 = 360
Pixels per column: 3 × 72 = 216
Total pixels: 360 × 216 = 77,760
77,760 × 3 bytes = 233,280 bytes
÷ 1024 = 227.8 KiB

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

  1. 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]
  2. 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]
  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:
  1. Total pixels = 1500 × 3000 = 4,500,000
    Image size = (4,500,000 × 8) ÷ 1,000 ÷ 1,000 =36 MB
  2. 1920 × 1536 = 2,949,120 pixels
    × 16 = 47,185,920 bits
    ÷ 8 = 5,898,240 bytes
    ÷ (1024 × 1024) =5.625 MiB
  3. 1024 × 1536 = 1,572,864 pixels
    × 24 = 37,748,736 bits
    ÷ 8 = 4,718,592 bytes
    16 GiB = 17,179,869,184 bytes
    17,179,869,184 ÷ 4,718,592 ≈3,640 photos

Check Your Understanding: Bitmap File Size

  • [1]File size = image resolution × colour depth
  • [1](in pixels) × (in bits) — then divide by 8 to get bytes
  • [1]800 × 600 × 24 = 11,520,000 bits
  • [1]11,520,000 ÷ 8 = 1,440,000 bytes
  • [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
  • [1]1024 × 1080 = 1,105,920 pixels
  • [1]× 32 = 35,389,440 bits ÷ 8 = 4,423,680 bytes
  • [1]÷ (1024 × 1024) ≈ 4.22 MiB
  • [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.)
  • [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 ImagesBitmap Images
Made up of geometric shapes which require definition/attributesMade up of tiny pixels of different colours
To alter/edit the design, it is necessary to change each of the geometric shapesPossible 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 shapesBecause 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 realisticSince images are built up pixel by pixel, the final image is usually very realistic
File formats are usually .svg, .cgm, .odgFile 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.

  1. A company logo that will be printed on business cards, letterheads, and a large billboard.
  2. A photograph of a family on holiday to be inserted into a digital photo album.
  3. An architectural diagram of a new house that needs to be scaled to different sizes.
  4. A screenshot of a web page to include in a textbook.
Solution:
  1. Vector graphic— it can be scaled to any size (from business card to billboard) without loss of quality.
  2. Bitmap image— a photograph is naturally a bitmap, as it is made up of pixels and needs to be realistic.
  3. Vector graphic— it can be scaled to different sizes without loss of quality, and is ideal for precise technical drawings.
  4. Bitmap image— a screenshot captures the exact appearance of the screen pixel by pixel.

Check Your Understanding: Vector Graphics

  • [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
  • [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
  • [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
  • [1]Vector: .svg, .cgm, .odg (any two)
  • [1]Bitmap: .jpeg, .bmp, .png (any two)
  • [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
  • [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]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
  • [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
  • [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
  • [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
  • [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)
  • [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
  • [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
  • [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
  • [1]1920 × 1536 = 2,949,120 pixels
  • [1]× 16 = 47,185,920 bits ÷ 8 = 5,898,240 bytes
  • [1]÷ (1024 × 1024) = 5.625 MiB
  • [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
  • [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)
  • [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
  • [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
  • [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