Codename "Nether Poppleton"
The goal of this encoder is to produce files with best filesize/quality ratio, regardless of encoding speed or memory cost.
Experimental features:
- Luma-weighed chroma subsampling — thin red lines on white or black background don't become desaturated.
- Less aggressive DC quantization — less banding (but more blurriness) at very low qualities.
- Derining by overflowing — less noise around black text on white background.
Compile with
make
Run
./encoder source.png output.jpg 50
These are carefully chosen examples that show certain improvements. They're not indicative of overall performance (and ImageMagick's JPEG encoder is generally okay).
JPEG shouldn't be used for line art, but people still do it. Now they can fail less at it.
ImageMagick = 7721B (left), this encoder = 7349B (right)
Deringing is implemented by overflowing white color (intensity used is 272 instead of 255). This way distortions are introduced out of visible range.
Color can be saved at half resolution. Poor subsampling darkens and desaturates red lines.
Original (left), ImageMagick = 7277B (middle), this encoder = 7173B (right)
This is done by weighing chroma by luma level. Needs further improvements to correct overall luminance.
Standard JPEG encoders are not tuned for very low quality. Bad quality doesn't have to be that bad.
ImageMagick = 5033B (left), this encoder = 4890B (right)
This is done by tweaking quantization tables. Further improvements are possible.