GNOME Bugzilla – Bug 785171
Restore grayscale jpeg support after fix for bug 784866
Last modified: 2017-08-07 21:45:47 UTC
After commit c2a40a92fe3df4111ed9da51fe3368c079b86926 (jpeg: Throw error when number of color components is unsupported), gdk-pixbuf will only load jpeg files with 3 or 4 color components. That precents the loading of grayscale images which have only one color component. The commit message mentions that 1 color component images are unsupported, but there is a specific function called explode_gray_into_buf to handle JCS_GRAYSCALE, and my test images were displayed correctly without that change. As far as I understand the code, 1 component JCS_GRAYSCALE images are safe to use and do not cause invalid writes.
Created attachment 356042 [details] [review] jpeg: restore grayscale image support
*** Bug 785155 has been marked as a duplicate of this bug. ***
Created attachment 356465 [details] [review] jpeg: Restore grayscale image support Commit c2a40a92fe3df4111ed9da51fe3368c079b86926 restricts the jpeg loader to files with 3 or 4 color components. Also allow JCS_GRAYSCALE images with only 1 color component. These grayscale images are supported through explode_gray_into_buf.
Created attachment 356466 [details] [review] tests: Add grayscale JPEG tests Originally from the JPEG conformance tests: http://people.sc.fsu.edu/~jburkardt/data/jpg/jpg.html
Fixed a few nits in the commit message and coding style, and added a test case. Thanks! Attachment 356465 [details] pushed as 6dd89e1 - jpeg: Restore grayscale image support Attachment 356466 [details] pushed as 4a46294 - tests: Add grayscale JPEG tests
*** Bug 785504 has been marked as a duplicate of this bug. ***