Image Compression
Image Compression
quality as possible. This is achieved by reducing redundant or irrelevant data, making the image
more efficient for storage or transmission.
1. Lossless Compression
o Reduces file size without losing any information.
o The original image can be reconstructed perfectly.
o Techniques include:
▪ Run-Length Encoding (RLE): Compresses sequences of the same value
(e.g., a row of identical pixels).
▪ Huffman Coding: Encodes frequently occurring pixel values with shorter
binary codes.
▪ PNG Format: Uses lossless compression.
2. Lossy Compression
o Reduces file size by discarding some data, often imperceptible to human eyes.
o Cannot reconstruct the original image perfectly.
o Techniques include:
▪ Transform Coding (e.g., JPEG):
▪ Converts the image into frequency components using techniques
like the Discrete Cosine Transform (DCT).
▪ Discards less noticeable high-frequency components.
▪ Quantization: Groups pixel values into fewer levels.
o JPEG and WebP Formats: Use lossy compression.
1. Compression Ratio:
1. Convert the image to YCbCr color space (separates luminance and chrominance).
2. Subsample the chrominance components (reduce resolution for human imperceptibility).
3. Divide the image into 8×88 \times 88×8 blocks.
4. Apply DCT to each block.
5. Quantize the DCT coefficients.
6. Apply Huffman coding to encode the quantized coefficients.
Challenges
• Loss of Quality (Lossy Compression): Visible artifacts may appear if the compression
is too aggressive.
• Processing Time: High compression ratios can increase computational complexity.
• Compatibility: Some advanced formats may not be supported across all devices.
Applications