Repository navigation
Conversation
Open
Contributor
Test coverageCompared with master where the branch left it (1de03d3).
Changed
|
This branch has not been deployed
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.
Adds
encodeJPEG({ quantization: 'flat' }): every detail is quantized alike instead of by the JPEG standard's tables. Edges and text come out clearer, and measured by PSNR and SSIM the files are about 10% smaller on average at the same quality (more or less by image).Refs #85.
'standard'by default, so existing files stay byte for byte the same. The samequalitymakes a larger file with'flat', so lower it to keep the size (by 15 to 25 for photos). The gain map isn't affected. The table is mozjpeg's flat one (all 16, scaled by the quality like the standard's), which mozjpeg uses for PSNR.Measured with mozjpeg's
cjpeg(no trellis) on a photo, a 2400×1600 photo and a screenshot at qualities 60, 80 and 92: at the same PSNR the files are 13% smaller on average (from 3% to 30%), at the same SSIM 9% (from 21% smaller to 15% larger, the photo at quality 60 is larger). I looked at crops at the same file size and found edges clearer and fewer artifacts.Checked:
cjpeg -qtables(libjpeg-turbo 2.1.5) with sixteens gives identical files for 432 cases;tests/jpeg-quantization.jskeeps 9 of them as hashes, plus one check that strokes come out with less error at the same file size.