Image compression during asset fetching in Docforge
Summary
Convert PNG images to WebP format at fetch time inside Docforge, before assets land in gardener/documentation. This reduces repository size by ~70% and improves page load performance without extra CI steps or follow-up commits.
Motivation
PR #934 explored PNG→WebP conversion as a post-commit GitHub Action on gardener/documentation. After discussion, we aligned on handling compression inside Docforge at fetch time, so that uncompressed PNGs never enter the repository in the first place.
Why this approach:
- Compression at fetch time handles both local
website/ and aggregated repo assets in one place
- No extra CI step, no follow-up commits dirtying the history
- Docforge already downloads the files — compression fits naturally in that step
Scope
| Task |
Title |
Link |
| Task 1 |
Research fetch pipeline & choose compression library |
#1 |
| Task 2 |
Implement PNG→WebP conversion + config in .docforge manifest |
#2 |
| Task 3 |
Handle edge cases: animated PNGs, photographs, exclude list |
#3 |
| Task 4 |
Add tests for compression logic |
#4 |
Configuration (target API)
compress_images: true # default: false (opt-in)
image_quality: 85 # default: 85, range 1–100
exclude_patterns: # default: []
- "2025-*.png"
- "hackathon/**"
Out of scope
- JPG/JPEG files — re-compressing causes visible quality loss, intentionally skipped
- Animated PNGs — detected and kept as-is (handled in Task 3)
- SVG files — no conversion needed
Related
Image compression during asset fetching in Docforge
Summary
Convert PNG images to WebP format at fetch time inside Docforge, before assets land in
gardener/documentation. This reduces repository size by ~70% and improves page load performance without extra CI steps or follow-up commits.Motivation
PR #934 explored PNG→WebP conversion as a post-commit GitHub Action on
gardener/documentation. After discussion, we aligned on handling compression inside Docforge at fetch time, so that uncompressed PNGs never enter the repository in the first place.Why this approach:
website/and aggregated repo assets in one placeScope
Configuration (target API)
Out of scope
Related
website/to WebP format to reduce repository size and improve page load performance #934in-memory during download, and writes only the compressed WebP to
gardener/documentation. No extra CI step, no follow-up commits.