Apply WebP quality 80 to generated thumbnails #89

Closed
opened 2026-07-20 19:44:02 +00:00 by hugo · 1 comment
Owner

Source: Audit section 3.

Spec: specs/media_processing.allium config: 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): the image crate'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 webp crate (libwebp bindings) or image newer 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 --workspace green; no CDN/external deps added beyond the encoder crate.

**Source:** Audit section 3. **Spec:** `specs/media_processing.allium` config: 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): the `image` crate'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 `webp` crate (libwebp bindings) or `image` newer 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 --workspace` green; no CDN/external deps added beyond the encoder crate.
hugo added the bug label 2026-07-20 19:44:02 +00:00
Author
Owner

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.

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.
hugo closed this issue 2026-07-22 16:33:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#89