Skip to content

fix(sqzer): a quality on a graphic picked for lossless WebP is reported lossless - #58

Merged
vlad-salone merged 2 commits into
mainfrom
fix/quality-on-lossless-only-encoder
Oct 13, 2026
Merged

vlad-salone merged 2 commits into
mainfrom
fix/quality-on-lossless-only-encoder

Conversation

@vlad-salone

Copy link
Copy Markdown
Collaborator

Closes #56, the first way out from the issue: the record is truthful about what the encoder did.

With no format, a graphic goes to WebP, and the portable encoder for it only writes lossless. A quality went to it anyway, so the record said quality: 80, lossless: false over the same bytes a run without quality wrote. The facade now treats an explicit quality on a lossless-only encoder it picked per image as it already treated a perceptual target: one encode, Output::target is Resolved::Lossless, Output::lossless is true, no quality in the record. --json, {quality} in a --template, the dry run and the npm package follow from that.

# before: in-80.webp, "quality": 80, "lossless": false
# after:  in-lossless.webp, "lossless": true, no quality
sqzer graphic.png -q 80 --json --template '{stem}-{quality}.{ext}'

Named with Sqzer::format it is a different request: a lossy mode asked for by name. The README and the package README say that throws EncoderUnavailable, and the CLI refuses -f webp -q 80 with exit 3, but the library and the package encoded lossless and reported the quality. They now return EncoderUnavailable with native-webp in available_in, from a new Format::lossy_encoder_features, and Unsupported for PNG, which no build writes lossy, the mirror of what the JPEG encoder says for lossless. One facade test encoded PNG at a quality and now passes Target::Lossless; the changelog entry says the same for a caller who did that.

Not in here: the CLI's render_unavailable still finds the native feature by prefix. It could read lossy_encoder_features instead, but the message is right as it is and that is a separate cleanup.

Checked locally: cargo test -p sqzer-core -p sqzer -p sqzer-cli, cargo clippy --workspace --all-targets --all-features, cargo doc with warnings denied, cargo deny check, and wasm-pack test --node, 17 tests, the new one among them.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous breaking-change notice is now complete.

Summary

The PR makes reports match lossless-only output and rejects explicitly named lossy modes that the build cannot write.

  • Picked WebP graphics report lossless output even with a quality request.
  • Named formats reject quality requests their encoders cannot meet.

Reviews (2) · Last reviewed commit: "docs(changelog): the named-format refusa..." · Reviewed by Greptile

Comment thread CHANGELOG.md Outdated
@vlad-salone
vlad-salone force-pushed the fix/quality-on-lossless-only-encoder branch from d2b1f0d to 515804d Compare October 13, 2026 13:06
vlad-salone and others added 2 commits October 13, 2026 15:14
…ed lossless

With no format set, a graphic goes to WebP, whose portable encoder only
writes lossless. An explicit quality went to that encoder as it was, so
the record said the quality asked for and `lossless: false` over bytes
that were lossless. The facade now treats a quality on a lossless-only
encoder picked per image as it treats a perceptual target: one encode in
the encoder's one mode, reported as `Resolved::Lossless`. The CLI's dry
run plans the same name.

Named with `Sqzer::format`, a quality on such an encoder is what the
README has said and the command line has done: `EncoderUnavailable`
naming `native-webp`, through `Format::lossy_encoder_features`, and
`Unsupported` for PNG, which no build writes lossy.

Closes #56

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vlad-salone
vlad-salone force-pushed the fix/quality-on-lossless-only-encoder branch from 515804d to 6e5a73d Compare October 13, 2026 13:14
@vlad-salone
vlad-salone merged commit 9a14714 into main Oct 13, 2026
22 checks passed
@vlad-salone
vlad-salone deleted the fix/quality-on-lossless-only-encoder branch October 13, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

encode with quality and no format picks lossless WebP for a graphic and reports quality, not lossless

1 participant