Created attachment 120624 [details] PDF including several test images Poppler seems to properly decode most non-transparent JPEG 2000 images in PDFs. However, transparent JPEG 2000 images are distorted beyond recognition. Attached is a PDF with five images: 1. A transparent bitmap 2. #1 converted into a transparent JPEG 2000 with OpenJPEG 3. #1 converted into a transparent JPEG 2000 with GraphicsMagick (no idea how it does this; possibly it just invokes OpenJPEG) 4. #1 converted into a non-transparent JPEG 2000 with GraphicsMagick 5. #1 converted into a non-transparent JPEG 2000 with Jasper All the images display fine except for the two transparent JPEG 2000s.
Created attachment 120625 [details] PNG showing how Attachment 120624 [details] is rendered The attached PNG file shows how Attachment 120624 [details] is rendered by Okular, Evince, Gimp, etc.
Mmmh, Tristan, image 2 and 3 contain an alpha channel and are therefore not handled correctly by poppler. BUT: where in case of image 1 an image object and a corresponding smask is set in the PDF and so the transparency remains, the parameter SMaskInData is not set for image 2 and 3. The PDF spec says that in this case the alpha channel in the jpx encoded data should be ignored (Default: SMaskInData = 0). So these images will remain non-transparent and look like image 5. I will upload a patch that handles SMaskInData = 0 correctly but still will not display correctly if SMaskInData is 1 or 2. This would mean more effort also in the output devices to handle that correctly, so I will not implement that before I get some good examples.
Created attachment 122230 [details] [review] handle SMaskInData = 0 for JPX encoded images This patch fixes it in case of SMaskInData = 0
Pushed
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.