Image representation
Published by Patrick Mutisya 10 months and 11 days ago
Image Representation
An image is a visual
representation of objects, scenes, or data. On a computer, images are stored as
a series of pixels, which are small colored dots or squares.
Key Terminology
- Pixels - A pixel (short for "picture
element") is the smallest unit of a digital image. Each pixel has a
specific color, and when combined with other pixels, it forms an image.
- Resolution: The number of pixels in the image
(width height).
- Color depth: The number of bits used to
represent each pixel's color.
- Compression: Reducing the file size of an
image.
- Aspect Ratio: The ratio of the width to the
height of an image (e.g., 16:9).
Types of Image Representation
Images can be represented in two
main ways on computers:
1.
Bitmap (Raster) Images
- They are made up of a grid of pixels.
- Some file formats include: BMP, PNG, GIF, JPEG.
- Each pixel has a specific color stored in
binary.
- The higher the resolution, the more
detail the image has but also the more storage it requires.
- It is the best choice for photos and detailed
images.
- It loses quality when scaled up or down (becomes
pixelated).
2.
Vector Images
- Made up of mathematical paths and shapes like
lines, curves, and polygons.
- Some file formats include SVG, EPS, PDF.
- The computer uses mathematical equations to draw
the image, so no pixels are involved.
- They Can be resized without losing quality
(scalable).
- They are better for logos or illustrations.
- They are not suitable for detailed images like
photographs.
How Pixels Store Colors
- Computers use binary to store information, so
colors must be represented using numbers.
- Common methods for storing colors:
A. Monochrome (1-bit)
- The image is black and white.
- Each pixel is represented by a single bit: 0 for
black, 1 for white.
B. Grayscale (8-bit)
- An image contains shades of gray, from black to
white.
- Each pixel is represented by 8 bits (1 byte),
allowing 256 shades of gray (from 0 to 255).
C. True Color (24-bit)
- Each pixel contains a color made up of three
components: Red, Green, and Blue (RGB).
- Each component is represented by 8 bits, so the
full pixel is represented by 24 bits (3 bytes).
- This allows for over 16 million possible colors
(256 values for each of the 3 components: 256 256 256 = 16,777,216).
Image File Size calculation
- The size of an image file depends on Resolution
and Color depth
- Formula for file size:
File Size (in bits)
= Width Height Color Depth (in bits per pixel)
Image Compression
Images are often compressed to
reduce file size. There are two types:
A. Lossy Compression
- Some data is lost during compression to reduce
file size.
- An example file format is JPEG.
- They have Smaller file sizes.
- Image quality is reduced.
B. Lossless Compression
- No data is lost; the image can be restored
exactly as it was.
- An example file format is PNG, GIF.
- There is no loss in image quality.
- They have larger file sizes compared to lossy
compression.