Bitmap Images
IBDP Computer
Science – DP1
Pixels • Resolution • Colour Depth • RGB
The Blurry Billboard
Disaster
• Imagine Apple launches a
new iPhone.
• The image looks perfect on
the designer's laptop.
• But on a giant Bangalore
billboard… it looks blurry and
pixelated!
• Why did this happen?
What is a Bitmap?
• A bitmap (raster) image is made of a grid of
pixels.
• Each pixel stores a colour value.
• Pixel = smallest unit of a digital image.
• Raster = grid-based structure.
Image Resolution
• Resolution = width × height (in pixels)
• Example: 13 × 10 = 130 pixels
• Higher resolution = more detail
• But also larger file size
Colour Depth (Bit
Depth)
• Colour depth = number of
bits per pixel
• 1-bit → 2 colours
• 8-bit → 256 colours
• 24-bit → 16.8 million
colours
• Formula: Number of
colours = 2^bit depth
Image Size Formula
• Image size = width × height × colour depth
• Result is in bits
• Divide by 8 to convert to bytes
• Real files are larger due to metadata
What is Metadata?
• Metadata = data about data
• Includes: dimensions, colour depth, date created
• Also includes header information
• Allows CPU to interpret image correctly
Resolution and PPI
• PPI = pixels per inch
• Higher PPI = sharper image
• Same resolution looks
different on phone vs
cinema screen
• Screen size matters!
Common Screen Resolutions
• HD – 1280 × 720
• Full HD – 1920 × 1080
• 4K – 3840 × 2160
• 8K – 7680 × 4320
RGB Colour Model
• 24-bit images use RGB
• 8 bits per channel
(Red, Green, Blue)
• Each channel
ranges from 0–255
• Example: R=216,
G=190, B=199
• Hex equivalent:
#d8bec7
Trade-Offs in Bitmap Images
• Higher resolution → better detail → larger file
size
• Higher colour depth → smoother gradients → larger
file size
• Storage and transfer speed must be considered
Practice
• 1) 10 × 12 image, 4-bit depth
• 2) 800 × 600 image, 9-bit depth
• Calculate pixels, bits, bytes, kB
Answers
• 1) Image: 10 × 12 pixels, 4-bit colour depth
• • Total pixels = 10 × 12 = 120 pixels
• • Number of colours = 2^4 = 16 colours
• • File size (bits) = 10 × 12 × 4 = 480 bits
• • File size (bytes) = 480 ÷ 8 = 60 bytes
• 2) Image: 800 × 600 pixels, 9-bit colour depth
• • Total pixels = 800 × 600 = 480,000 pixels
• • Number of colours = 2^9 = 512 colours
• • File size (bits) = 800 × 600 × 9 = 4,320,000
bits
• • File size (bytes) = 4,320,000 ÷ 8 = 540,000
bytes
• • File size (kB) = 540,000 ÷ 1024 ≈ 527.34 kB