Repository navigation
feat: add a budget mode that compares quality at equal file size - #63
Merged
Merged
Conversation
--target-bytes searches each codec for the largest file that fits a byte budget (KB/MB decimal, KiB/MiB binary, or a bare byte count) and ranks codecs by the ssimulacra2 they reach there. The search reads only the encoded size, so it decodes and scores once per codec, which makes a budget run about half as long as an equal-quality run on the demo images. The batch summary averages quality over the images where every codec fits, so codecs are ranked on the same images. Tables, summary and CSV are supported; --html, --rd and --target are rejected alongside it.
Codec comparison ✅ no size or quality regression📥 Download the codec report (unzip and open Size check |
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.
Summary
Adds
--target-bytes <size>tocompare-codecs: the inverse of the equal-quality search. Given a byte budget, each codec is searched for the largest file that fits, and codecs are ranked by the ssimulacra2 they reach at that size, the question a web performance budget asks.KB/MBare decimal,KiB/MiBbinary, a bare number is bytes. Tables state the budget both ways and show exact byte sizes plus the share of the budget used.*and ranked after the rest.--csvwrites one row per image and codec withbudget_bytesandfits.--html,--rdand--targetare rejected alongside it; budget mode in the HTML report stays on the roadmap.The quality and budget searches share the encode step, timing totals and final measurement in
pipeline.js, and the CLI's three modes share one image-normalization helper.Testing
node --test: 128 pass locally (2 codec-gated skips), 130/130 insideghcr.io/nucliweb/image-tools:latest.