feat: add LosslessMode enum (Lossy / NearLossless / Lossless)
- Dominant language
- Rust
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
- `with_lossless(bool)` can't express near-lossless modes that WebP, JXL, and PNG support
- WebP: `with_near_lossless(0-100)` pre-rounds pixels in VP8L lossless path
- JXL: distance 0.0-1.0 "perceptually lossless zone" (distinct from Modular lossless)
- PNG: `with_near_lossless_bits(1-4)` rounds LSBs before DEFLATE
- AVIF, JPEG, GIF have no near-lossless mode
## Proposal
Add to `EncoderConfig` trait:
```rust
enum LosslessMode {
Lossy,
NearLossless,
Lossless,
}
```
Codecs without near-lossless treat `NearLossless` as high-quality lossy. Replaces `with_lossless(bool)` (deprecate, keep working via `true` → `Lossless`, `false` → `Lossy`).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the EncoderConfig trait and the existing with_lossless(bool) API. Trace the WebP, JXL, and PNG encoding paths to understand their near-lossless settings, then check how AVIF, JPEG, and GIF handle quality modes. Done means LosslessMode is supported, the old boolean remains compatible through deprecation, and each codec follows the stated fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100