PNG: Cannot have Palette images with ICC profile #107
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
while this seems to be a valid PNG file, img2pdf gives 'error: Cannot have Palette images with ICC profile'
Hrm... this is indeed an oversight of mine. Thanks for finding this bug!
The following patch should fix the problem:
Curiously, you are the first person with a palette PNG image that comes with an ICC profile. Do you know which software produces these? The metadata of your image suggests this comes from ghostscript?
Thanks for your quick answer and solution! I am not into all these formats, so did not know PNG is always RGB.
I do not know which software the image was produced, it is a page of a book which the publisher published as individual PNG pages. I selected a blank page, which made clear it was not due to the (visible) contents of the page.
Okay, awesome. The fix should be part of the next img2pdf release. If you do not want to wait that long, feel free to apply above patch to your local copy. Thanks again!
unfortunally there is still a problem: the resulting pdf is reported as not valid by Acrobat Reader: 'due to an error on the page the page is possibly not correctly displayed'.
Ahaa! I'm a donkey. Thanks for re-opening this. The original error message "Cannot have Palette images with ICC profile" makes sense. In the PDF format you specify the colorspace to either be ICCBased or Indexed aka palette-based. So we cannot store a palette PNG with an ICC profile in PDF directly. Instead, we have to convert the palette PNG to a normal RGB-png to fix this bug.
I am so happy that you KNOW these intricate file-format details and share your knowledge by providing such a good library! Many years ago I made a tiff-conversion thing for a project and that was difficult enough. From the little I know form the pdf format is that it is very difficult due to a version built-up of 'features' and backward compatibillity.
Many thanks for looking into this!