Resources | Subject Notes | Computer Science
Bitmapped images, also known as raster images, are composed of a grid of pixels. Each pixel holds information about its color. This information is encoded in a specific format, which dictates how the pixel data is stored and interpreted. Understanding these encoding methods is crucial for computer graphics and image processing.
A pixel's color is typically represented using a combination of red, green, and blue (RGB) components. The intensity of each component determines the final color. The range of intensity for each color channel is usually from 0 to 255, although other ranges are possible.
Several encoding methods exist for storing bitmapped image data. The choice of method impacts file size, image quality, and compatibility.
Common bitmap file formats include BMP, GIF, PNG, and JPEG. Each format employs a different encoding scheme.
Attribute | Description |
---|---|
Header Size | Typically 40 bytes |
Data Size | Variable, depends on image dimensions and color depth |
Color Depth | Determines the number of bits used to represent each pixel. Common depths are 1-bit (black and white), 8-bit (256 colors), 24-bit (true color), and 32-bit (true color with alpha channel). |
BMP files store pixel data in a straightforward manner, with each row of pixels stored sequentially. The header contains information about the image dimensions, color depth, and data offset.
Attribute | Description |
---|---|
Compression | Uses LZW (Lempel-Ziv-Welch) lossless compression. |
Color Palette | Supports a maximum of 256 colors. A color palette is used to store the index of each color. |
Transparency | Supports a single color for transparency. |
GIF is commonly used for simple animations and images with limited color palettes. LZW compression makes it efficient for images with repeating patterns.
Attribute | Description |
---|---|
Compression | Uses DEFLATE lossless compression. |
Color Depth | Supports various color depths, including 8-bit, 24-bit, and 48-bit. |
Transparency | Supports alpha transparency, allowing for variable levels of transparency. |
PNG is a more advanced format than GIF, offering better compression and support for transparency. It's often preferred for images with sharp lines and text.
Attribute | Description |
---|---|
Compression | Uses DCT (Discrete Cosine Transform) lossy compression. |
Color Depth | Supports 24-bit color (true color). |
Transparency | Does not natively support transparency. |
Compression Level | Adjustable compression levels, affecting file size and image quality. Higher compression leads to smaller file sizes but more noticeable artifacts. |
JPEG is widely used for photographs and images with complex color gradients. Lossy compression reduces file size by discarding some image data, which can result in visible artifacts at high compression levels.
Different color models are used to represent colors in digital images. The most common are:
The choice of encoding method depends on the specific requirements of the image. Factors to consider include file size, image quality, and the need for transparency.