๐ผ️ Image Compression Techniques
Learn how digital images are compressed using mathematical and information-theoretic techniques such as RLE, Huffman Coding, DCT, Quantization and JPEG.
1️⃣ Upload Your Image
2️⃣ Image for Compression Study
๐ผ️ Original Image
Upload an image to begin.
⚫ Grayscale Version
3️⃣ What is Image Compression?
Image compression reduces the number of bits required to represent an image while attempting to preserve the important visual information.
๐ข Lossless Compression
The reconstructed image is exactly identical to the original image. No information is permanently lost.
Examples: RLE, Huffman, LZW, PNG.
๐ Lossy Compression
Some information is discarded to obtain a much smaller file. The reconstructed image is usually an approximation.
Example: JPEG.
๐ต Redundancy
Compression removes different forms of redundancy:
- Spatial redundancy
- Statistical redundancy
- Psychovisual redundancy
๐ฃ Main Goal
Reduce storage and transmission requirements while maintaining acceptable image quality.
4️⃣ Major Compression Techniques
| Technique | Type | Main Idea | Typical Use |
|---|---|---|---|
| RLE | Lossless | Encode repeated values | Simple images |
| Huffman | Lossless | Short codes for frequent symbols | JPEG / general coding |
| LZW | Lossless | Dictionary-based coding | GIF / TIFF |
| DPCM | Predictive | Encode prediction error | Image signals |
| DCT | Transform | Convert spatial data to frequency coefficients | JPEG |
| DWT | Transform | Wavelet decomposition | JPEG 2000 |
| Quantization | Lossy | Reduce coefficient precision | JPEG |
5️⃣ Compression Ratio
Compression ratio compares the original size with the compressed size.
Percentage reduction:
6️⃣ Run-Length Encoding (RLE)
RLE is a simple lossless compression technique. Instead of storing every repeated pixel separately, it stores the value and the number of consecutive repetitions.
๐ฌ Interactive RLE Demonstration
7️⃣ Entropy and Image Compression
Entropy measures the average information contained in the image intensity distribution.
For an 8-bit grayscale image:
8️⃣ DCT — Discrete Cosine Transform
JPEG divides an image into 8×8 blocks and applies the Discrete Cosine Transform to represent spatial intensity variations as frequency coefficients.
Original 8×8 image block.
DCT frequency coefficient.
Frequency coordinates.
Normalization factors.
8×8 Image Block
9️⃣ Quantization
Quantization reduces the precision of DCT coefficients. This is the major stage responsible for information loss in typical JPEG compression.
Larger quantization values produce stronger compression but usually lower image quality.
Small Quantization
More coefficients are retained.
Higher quality → Larger fileLarge Quantization
More coefficients become zero or smaller.
Lower quality → Smaller file๐ JPEG Compression Pipeline
Image
RGB → YCbCr
8×8 Blocks
DCT
Quantization
Zig-Zag
RLE
Huffman
Compressed
1️⃣1️⃣ Measuring Compression Quality
Mean Squared Error — MSE
where I is the original image and K is the reconstructed image.
Peak Signal-to-Noise Ratio — PSNR
For an 8-bit image:
1️⃣2️⃣ Lossless vs Lossy Compression
| Feature | Lossless | Lossy |
|---|---|---|
| Information loss | No | Yes |
| Reconstruction | Exactly original | Approximation |
| Compression ratio | Usually lower | Usually higher |
| Quality degradation | None | Possible |
| Examples | PNG, RLE, Huffman, LZW | JPEG |
| Best suited for | Medical/technical graphics, text-like images | Photographs and natural scenes |
1️⃣3️⃣ Three Types of Redundancy
1. Statistical Redundancy
Some symbols occur much more frequently than others. Huffman coding can exploit this redundancy.
2. Spatial Redundancy
Neighboring pixels often have similar values. Predictive and transform techniques can exploit this property.
3. Psychovisual Redundancy
Human vision does not perceive all image information equally. Lossy techniques can discard some less perceptually important information.
1️⃣4️⃣ Applications
๐ฑ Mobile Applications
Reducing image size saves storage and network bandwidth.
๐ Web Images
Compressed images improve page loading and reduce bandwidth usage.
๐ฐ️ Satellite Images
Compression reduces the amount of data that must be transmitted.
๐ฅ Medical Imaging
Lossless methods are particularly important when exact pixel information must be preserved.
๐น Video Processing
Image compression principles form an important foundation for video compression systems.
☁️ Cloud Storage
Compression can reduce storage requirements for large image collections.
No comments:
Post a Comment