Commit 2b65a2d
authored
fix: implement proper ZLIB compression to resolve PNG bloat (#964)
## Summary
- Implement proper Huffman compression to fix 100x PNG file bloat
- Replace uncompressed DEFLATE blocks with efficient compression
algorithm
- Restore normal PNG file sizes from 1.4MB to expected ~24KB range
## Technical Verification Evidence
**BEFORE FIX:**
- Simple plot: 1,440,774 bytes (1.4MB)
- Complex plot: 5,761,704 bytes (5.7MB)
**AFTER FIX:**
- Simple plot: 23,936 bytes (~24KB) - **60x smaller!**
- Complex plot: 927,928 bytes (~928KB) - **6x smaller!**
**Local Test Results:**
```
PNG File Size Scaling Test Results:
======================================
Empty plot size: 7265
Simple plot size: 23936
Complex plot size: 927928
PASS: PNG file sizes scale appropriately with content
```
**Full Test Suite:** All 107 tests pass with no regressions
**Build Status:** Clean compilation with zero errors
**Performance Impact:** Dramatic file size reduction with proper
compression
## Implementation Details
- Modified `zlib_compress()` in `fortplot_zlib_core.f90`
- Changed from `compress_with_uncompressed_blocks()` to
`compress_with_fixed_huffman()`
- Utilizes existing, well-tested Huffman compression implementation
- Maintains full ZLIB format compliance with proper headers and
checksums
Fixes #9631 parent 0f159df commit 2b65a2d
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
0 commit comments