Repository navigation
fix(sqzer): a quality on a graphic picked for lossless WebP is reported lossless - #58
Merged
Merged
Conversation
|
vlad-salone
force-pushed
the
fix/quality-on-lossless-only-encoder
branch
from
October 13, 2026 13:06
d2b1f0d to
515804d
Compare
…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
force-pushed
the
fix/quality-on-lossless-only-encoder
branch
from
October 13, 2026 13:14
515804d to
6e5a73d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. Aqualitywent to it anyway, so the record saidquality: 80, lossless: falseover the same bytes a run withoutqualitywrote. 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::targetisResolved::Lossless,Output::losslessistrue, no quality in the record.--json,{quality}in a--template, the dry run and the npm package follow from that.Named with
Sqzer::formatit is a different request: a lossy mode asked for by name. The README and the package README say that throwsEncoderUnavailable, and the CLI refuses-f webp -q 80with exit 3, but the library and the package encoded lossless and reported the quality. They now returnEncoderUnavailablewithnative-webpinavailable_in, from a newFormat::lossy_encoder_features, andUnsupportedfor 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 passesTarget::Lossless; the changelog entry says the same for a caller who did that.Not in here: the CLI's
render_unavailablestill finds the native feature by prefix. It could readlossy_encoder_featuresinstead, 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 docwith warnings denied,cargo deny check, andwasm-pack test --node, 17 tests, the new one among them.🤖 Generated with Claude Code