Skip to content

Image compression during asset fetching in Docforge #959

Description

@VelmiraS

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

Metadata

Metadata

Assignees

Labels

kind/enhancementEnhancement, improvement, extensionlifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions