-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust quantization tables for high-resolution displays #76
Comments
I'm not too familiar with how JPEG works, so just a general comment. This works, unless the image has gradients. |
With this change: ImageOptim@615652b |
@pornel On my high DPI display, the 2nd image (with your change) is different, but not better IMO. The sky gradients are less mangled, but the rocks and plants are much worse. |
@dwbuiten in the posterized image rocks and plants look more interesting due to color shifts and increased saturation, but that is actually also an error in the image. The bland version is actually closer to the original: http://optipng.sourceforge.net/pngtech/corpus/kodak/kodim21.png |
My subjective view is that the image after @pornel's change looks better. 👍 |
@pornel Looks like firefox was mucking with the image. Viewing in a proper image viewer indeed shows it looks better. Apologies. |
What exactly does "firefox was mucking with the image" mean? If there is a bug in Firefox we should file it. The only thing I've noticed about how Firefox renders images that is sub-optimal is that most browsers assume sRGB for JPEGs without a colorspace, Firefox doesn't. This is bad for compatibility, and the sRGB guess is correct more often than not. |
@bdaehlie On high DPI displays, firefox upsamples by default (as it should), but it doesn't do it so well with this set (it used to be bilinear, might be bicubic now -- there is a bug open or opened about changing it to lanczos... at least downsampling was fixed recently.) The best way I can kind of explain it is that the discoloration in the original image near the rocks, after upsampling, looked to be a more similar complexity to the original image to my eye (psychovisual effect -- the eye tends to prefer similar complexity to the source image than blurred, but more similar). It could also just be that my taste is biased. Sorry for the noise. |
No worries, I just want to make sure any major issues with Firefox's rendering get reported and fixed. |
|
GCC does support UAL syntax (strbeq) if the ".syntax unified" directive is supplied. This directive is supported by all versions of GCC and clang going back to 2003, so it should not create any backward compatibility issues. Based on mattsarett/libjpeg-turbo@1264349 Closes mozilla#76
There is a trick used when compressing images for high-DPI ("Retina") displays: because details are less visible in higher resolution (or when resampled on lower-resolution displays), the image can tolerate higher level of compression.
http://filamentgroup.com/lab/compressive-images.html
http://gogrowstrategies.com/compressive-images/
Unfortunately in libjpeg the quantization tables are derived from default tables by proportionally scaling all coefficients.
The problem with that is that very low quality settings cause DC to be quantized too heavily, virtually guaranteeing that the image will look blocky and posterized. Giving bits to ACs can't help if the DC is awful.
My suggestion is:
jpeg_add_quant_table
to quantize DC and the first few ACs less when the quality is very low.cjpeg
for optimization for high-dpi displays. It'd adjust quality scale (lower the quality), quantization tables (protect DC from getting too blocky) and perhaps adjust the lambda for trellis.The implementation I've done ImageOptim@615652b just increases DC and the first few ACs. It does work, but maybe an even more elegant approach would be to devise quantization tables optimized for low and high qualities and crate final quantization table from interpolation between these tables.
The text was updated successfully, but these errors were encountered: