๐ผ️ Lossy Image Compression
Interactive JPEG Compression • DCT • Quantization • MSE • PSNR
๐ What is Lossy Compression?
Lossy compression reduces the size of an image by permanently removing some information that is less important to human visual perception.
๐ค 1. Upload Image
Upload a photograph or other image to demonstrate lossy JPEG compression.
๐ผ️ 2. Original vs Compressed Image
Original Image
Compressed JPEG
๐️ 3. JPEG Quality Control
Move the slider to change JPEG compression quality.
Higher quality → larger file → less information loss
Lower quality → smaller file → more information loss
๐ 4. Compression Results
| Parameter | Result |
|---|---|
| Image Dimensions | - |
| JPEG Quality | - |
| Original File Size | - |
| Compressed File Size | - |
| Compression Ratio | - |
| Size Reduction | - |
| MSE | - |
| PSNR | - |
⬇️ Download Compressed JPEG
๐งฎ 5. Mathematics of Lossy Compression
Step 1 — DCT
DCT transforms pixel information from the spatial domain into the frequency domain.
Step 2 — Quantization
This is the main lossy operation in JPEG.
Step 3 — Encoding
๐ฏ 6. Quantization Example
Suppose a DCT coefficient is:
T(u,v) = 10
Q(u,v) = round(137 / 10)
Q(u,v) = round(13.7)
Q(u,v) = 14
During reconstruction:
F'(u,v) ≈ 140
Reconstructed coefficient ≈ 140
Therefore, some information has been lost.
๐ 7. Measuring Image Quality
Mean Squared Error — MSE
Lower MSE means the compressed image is closer to the original image.
Peak Signal-to-Noise Ratio — PSNR
For an 8-bit image:
๐ 8. JPEG Lossy Compression Pipeline
⚖️ 9. Lossless vs Lossy Compression
| Feature | Lossless | Lossy |
|---|---|---|
| Information Loss | No | Yes |
| Original Recovery | Exact | Not exact |
| File Size | Moderate | Usually smaller |
| Quality | Original quality | Depends on compression |
| Examples | PNG, RLE, Huffman | JPEG |
✅ 10. Advantages of Lossy Compression
- Significantly reduces image file size.
- Reduces storage requirements.
- Reduces network transmission time.
- Useful for websites and online applications.
- JPEG provides adjustable quality levels.
⚠️ Disadvantages
- Some information is permanently removed.
- Repeated compression can reduce quality.
- Very high compression can produce visible artifacts.
- The original image cannot be reconstructed exactly.
No comments:
Post a Comment