JPEG: Support 2-to-16-bit lossless JPEG images with libjpeg-turbo 3.1+; Support additional IDCT scaling factors with libjpeg-turbo and libjpeg v7+#8445
JPEG: Support 2-to-16-bit lossless JPEG images with libjpeg-turbo 3.1+; Support additional IDCT scaling factors with libjpeg-turbo and libjpeg v7+#8445urban-warrior merged 2 commits intoImageMagick:mainfrom dcommander:jpeg-format-enhancements
Conversation
- If compiled with libjpeg-turbo 3.1.x or later and lossless JPEG compression is selected, directly encode pixel data with 2 to 16 bits per channel into a lossless JPEG image with the same data precision, rather than upconverting to an 8-bit-per-sample, 12-bit-per-sample, or 16-bit-per-sample lossless JPEG image. (If compiled with libjpeg-turbo 3.0.x, upconverting is still performed.) - If compiled with libjpeg-turbo 3.1.x or later, directly decode lossless JPEG images with 2 to 16 bits per sample into pixel data with the same data precision, rather than upconverting to 8-bit-per-channel, 12-bit-per-channel, or 16-bit-per-channel pixel data. - If compiled with libjpeg-turbo 3.0.x or later and lossy JPEG compression is selected, upconvert or downconvert pixel data with 9 to 16 bits per channel into a 12-bit-per-sample lossy JPEG image. - If compiled with libjpeg-turbo 2.1.x or earlier (or libjpeg), upconvert or downconvert pixel data with 2 to 16 bits per channel into an 8-bit-per-sample lossy JPEG image.
|
Force-pushed to correct a couple of formatting issues and fix the Windows build. |
|
In the next release writing high depth jpeg files will require setting the |
|
Playing Devil's advocate, can't users simply force the output bit depth to 8 if they want compatibility with more limited decoders? If you convert, say, a 16-bit PPM image into a 16-bit TIFF or PNG image, ImageMagick doesn't silently drop the bit depth in order to preserve backward compatibility with more limited decoders. It fully uses the capabilities of the most popular TIFF and PNG decoders. libjpeg-turbo is the most popular JPEG decoder, as well as the official ISO/ITU-T reference implementation. My main concern is that there may be a chicken-and-egg issue. If ImageMagick supports all JPEG-1 variants by default, then it will encourage other applications to do likewise, and those other applications can now easily do so by using libjpeg-turbo. However, if ImageMagick doesn't support all JPEG-1 variants by default, then other applications will have little impetus to do so, and higher-bit-depth and lossless images will remain orphaned even though they are conformant JPEG-1 images. Perhaps disabling A bit of historical context: |
…ta precision error message (#8445).
|
Even common browsers (firefox, google chrome) don't support 12-bit jpeg and I just found out about that (after Image Magick upgrade (to 7.1.2-9) which "broke" thumbnail generation on some web pages. Now on 7.1.2-13, so problem solved here). |
Prerequisites
Description
These changes have been validated using a set of scripts that iterates over the various permutations of JPEG settings and formats using separate builds of IM targetting libjpeg-turbo 3.1.x, 3.0.x, and 2.1.x, as well as libjpeg v6b with Ken Murchison's lossless JPEG patch.