Apply WebP quality 80 to generated thumbnails #89
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: Audit section 3.
Spec:
specs/media_processing.alliumconfig: thumbnail_format webp, thumbnail_quality 80 (small/medium/large), ai JPEG quality 85.Current behaviour (RuDS):
crates/bds-core/src/util/thumbnail.rs(~line 109): theimagecrate's WebP encoder ignores the quality parameter (comment in code: "image crate WebP encoder doesn't expose quality directly") — output is lossless/default WebP, larger files than bDS2's q80 output. JPEG quality 85 for the ai thumbnail IS applied.Task: Encode WebP at quality 80. Rust ecosystem moves fast — check current options on the web first (per AGENTS.md): the
webpcrate (libwebp bindings) orimagenewer releases with lossy WebP support. Keep dimensions/naming/bucketing unchanged. Re-verify the thumbnail tests and add one asserting the encoder path produces lossy output (e.g. file size heuristic vs lossless, or encoder API assertion).Acceptance: Thumbnails are lossy WebP q80;
cargo test --workspacegreen; no CDN/external deps added beyond the encoder crate.Implemented in
bdfe57b. Replaced image 0.25's lossless-only WebP output with webp 0.3.1/libwebp encode_simple(false, quality), preserving RGBA alpha input and passing the existing production q80 value for small/medium/large thumbnails; the AI JPEG path remains q85. Dimensions, resize behavior, filenames, and bucket paths are unchanged. Added a deterministic regression asserting the generated WebP contains a lossy VP8 primary chunk instead of VP8L. The encoder dependency disables optional image integration and statically links libwebp; no CDN or runtime library was added. Verified against current primary image/webp crate docs, bDS2 Image.write quality 80 behavior, and specs/media_processing.allium. cargo machete, all thumbnail tests, cargo build --workspace, and cargo test --workspace pass; neutral review found no remaining gaps.