3.4.1 How Images are Represented in a Computer
In the world of digital computing, images are not stored as photographs or drawings like in the physical world. Instead, they are broken down into tiny units called pixels (short for “picture elements”). Every image you see on a computer screen, from a simple black-and-white icon to a high-resolution photograph, is made up of thousands or even millions of pixels arranged in a grid.
What is a Pixel?
- A pixel is the smallest unit of a digital image. Each pixel contains color information that contributes to the overall appearance of an image.
- If you zoom in very closely on a digital picture, you will see that it is made up of tiny squares of different colors—these are the pixels.
- The more pixels an image has, the higher the resolution, which means better image quality.
Example of Pixels in an Image
Think of an image as a mosaic made up of tiny tiles. Each tile represents a pixel, and when viewed from far away, the combination of all these pixels forms a complete image.
If you were to look at an 8×8 pixel grid:
⬜⬜⬜⬛⬛⬜⬜⬜
⬜⬜⬛⬛⬛⬛⬜⬜
⬜⬛⬛⬛⬛⬛⬛⬜
⬜⬛⬛⬛⬛⬛⬛⬜
⬜⬜⬛⬛⬛⬛⬜⬜
⬜⬜⬜⬛⬛⬜⬜⬜
Each block represents a single pixel, and together they create a pattern, just like pixels form an image.
3.4.2 Color Representation in Pixels (Binary and RGB Model)
Since computers can only process data in binary (0s and 1s), they need a way to store color information using numbers. Each pixel’s color is stored as a binary value, which determines how it will appear on the screen.
How Does a Computer Store Pixel Colors?
- Computers use different methods to store colors, but one of the most common systems is the RGB (Red, Green, Blue) model.
- The RGB model mixes three primary colors—Red, Green, and Blue—to create millions of different colors.
- Each color channel (R, G, and B) is stored as a binary number, typically using 8 bits per channel.
Color Depth (8-bit vs. 24-bit Representation)
- 8-bit Color:
- A pixel in 8-bit color can store only 256 different colors.
- Each color is represented by a single binary value.
- Example: Black = 00000000, White = 11111111.
- 24-bit Color (True Color):
- A pixel in 24-bit color has 8 bits for Red, 8 bits for Green, and 8 bits for Blue (totaling 24 bits).
- This allows for 16.7 million different colors.
- Example: Pure Red = (255, 0, 0) → 11111111 00000000 00000000.
Color |
Decimal (RGB) |
Binary Representation (24-bit) |
Black |
(0,0,0) |
00000000 00000000 00000000 |
White |
(255,255,255) |
11111111 11111111 11111111 |
Red |
(255,0,0) |
11111111 00000000 00000000 |
Green |
(0,255,0) |
00000000 11111111 00000000 |
Blue |
(0,0,255) |
00000000 00000000 11111111 |
Yellow |
(255,255,0) |
11111111 11111111 00000000 |
This binary color representation helps computers accurately store and display images.
3.4.3 Image Resolution and Pixel Density
The resolution of an image refers to the number of pixels used to display the image. It is measured in width × height (in pixels).
Common Image Resolutions
Resolution |
Pixel Count |
640 × 480 |
307,200 pixels |
1280 × 720 (HD) |
921,600 pixels |
1920 × 1080 (Full HD) |
2,073,600 pixels |
3840 × 2160 (4K) |
8,294,400 pixels |
The higher the resolution, the sharper the image, but it also requires more storage space.
Pixel Density (PPI – Pixels Per Inch)
- The pixel density of an image determines how sharp it appears on a screen.
- It is measured in PPI (Pixels Per Inch).
- Higher PPI = clearer, more detailed image.
Real-World Example: Comparing Low vs. High Resolution
- A low-resolution image (e.g., 100×100 pixels) will appear blurry and pixelated when enlarged.
- A high-resolution image (e.g., 1920×1080 pixels) will remain sharp even when enlarged.
3.4.4 Binary Representation of a Simple Image
Since images are stored as pixels with colors in binary form, we can represent a simple black-and-white image using 1s and 0s.
For example, let’s represent a small 5×5 black-and-white image:
1 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1
- 1 represents a black pixel.
- 0 represents a white pixel.
Each pixel in this image can be stored as a single binary value (1-bit per pixel). This is how monochrome (black & white) images are stored efficiently.
For a grayscale image, each pixel can have a range of values from 00000000 (black) to 11111111 (white), allowing for shades of gray.
3.4.5 Lossy vs. Lossless Image Compression
Since images can take up a lot of storage space, computers use compression techniques to reduce file size.
Lossy Compression
- Removes some image details to reduce file size.
- Common format: JPEG (.jpg)
- Example: Reducing a 5MB image to 1MB by simplifying colors and removing unnecessary data.
- Downside: Image quality is slightly reduced.
Lossless Compression
- Stores all original image data without losing quality.
- Common formats: PNG, BMP
- Example: A PNG file retains the exact color of every pixel, making it ideal for professional use.
3.4.6 Real-World Applications of Digital Images
- Digital Photography: High-resolution images captured by smartphones or cameras use pixels and binary data.
- Medical Imaging (X-rays, MRI scans): Digital images help in accurate diagnosis.
- Computer Graphics and Gaming: High-resolution textures improve visual effects in games and movies.
- Facial Recognition & AI: Pixel patterns help AI identify and verify faces in security systems.
- Social Media & Online Streaming: Platforms like Instagram, YouTube, and TikTok rely on efficient image and video encoding.
3.4.7 Key Takeaways
- Pixels are the smallest unit of an image, stored as binary data.
- RGB color model is used in most digital images, with 24-bit color depth allowing for 16.7 million colors.
- Resolution (width × height) determines the sharpness of an image, while PPI affects display quality.
- Binary representation of images allows computers to store and process pictures efficiently.
- Compression techniques (lossy vs. lossless) help reduce file sizes while maintaining acceptable quality.
Final Thought
Now that we understand how images are represented, stored, and displayed on computers, we can explore more advanced topics such as how images are transmitted over the Internet (Chapter 4) and how different multimedia formats use encoding techniques (Year 8 and Year 9).
This knowledge also forms the basis for image processing in AI, digital art, and computer graphics, which students may encounter in the future.