Repository navigation
feat(codecs): png:colors and png:dither, palette reduction through quantizr - #52
Merged
Merged
Conversation
…antizr ADR-0012. `-x png:colors=<2..=256>` reduces a PNG to a palette inside `OxipngEncoder`, `png:dither` sets the error diffusion, and an image that already has that few colours is written exactly at its own depth. `Encoder::exact` says when an option gives samples up at a lossless target, `Output::lossless` carries the result into the CLI record and the npm package, and a lossless target next to such an option is refused. `png:optimize_alpha=true` is one of those options. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
`lossy_options` asked `exact` about each option alone, so an encoder that gives samples up only under a combination came back with nothing named, and the output was reported lossless. When the encoder is not exact and no single option is to blame, every option set is named. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What and why
-x png:colors=<N>is here, whatrimagehad as--quantization: the first item ofROADMAP.md, built as ADR-0012 decided. All five of its action items are ticked.A lossless target next to such an option is refused: exit 2 when
-fnames the format, at the image when the format is picked per image, in a dry run too.What the action items asked to be measured:
The score at 16 is below zero and not broken: sixteen colours dithered over the 48 x 32 gradient are mostly noise to the metric. On a screenshot the same setting scores in the sixties. It is a regression check, as the
webpxrow is.Where it departs from the record, each noted on its action item:
clarifyentry indeny.toml.cargo deny0.20.2 reads the MIT text from the licence file by itself, and an entry with a wrong hash was ignored while the check stayed green, so it pinned nothing.deny.tomlis untouched.png:colors=offis accepted, since every listed option has to take its documented default.Sqzer::lossy_optionsis new and public: it names the options an encoder is not exact under, so the facade, the CLI and the dry run refuse with the same words.The test that
exactis truthful runs over every option of every encoder with a lossless mode. Under the native tier it also holdswebp:alpha_quality,webp:sharp_yuvandjxl:containerto ADR-0012 D4, which had taken them fromlibwebp's documentation: all three keep every sample.New dependencies
quantizr1.4.3, MIT, no dependencies of its own. Its manifest names a licence file, the MIT text, and no SPDX expression;cargo deny checkpasses under the currentdeny.toml.Checklist
CHANGELOG.mdhas an entry under## Unreleased, if behaviour changesdocs/adr/README.mdand its entry in.greptile/files.json, if there is one (ADR-0012, merged in docs(adr): ADR-0012, palette reduction for PNG through quantizr #51)cargo fmt,cargo clippy --all-features,cargo test,cargo docandcargo deny checkpass locally🤖 Generated with Claude Code