Large image not processed
I have multiple images in my HTML-PDF transformation. All images have maximum width of 668px in HTML and displayed correctly. One image is not processed with the warning:
"warning: Unknown image format"
That image is png, with same bit-depth and other attributes (just like others). Only difference is that it is larger than others:
1632 x 918px vs 3198 x 1902px
4,43 MB vs 19,0 MB
Is there a image size limit in Prince?
That's large but it should still work, would you be able to email me (email@example.com) the image for testing?
The image appears to contain some very large text chunks that cause Prince and some other PNG processing tools to fail:
zTXt: chunk data is too large
Using ImageMagick to convert it to another PNG file gives errors:
convert: Exceeded size limit while expanding chunk `003.png' @ warning/png.c/MagickPNGWarningHandler/1669.
convert: ran out of profile data `003.png' @ warning/png.c/MagickPNGWarningHandler/1669.
However the resulting PNG file is only 5 Mb in size, contains fewer text chunks, and works fine with Prince, so I would suggest trying that.
We will investigate to see if we can figure out why libpng does not like the file.
The problem is caused by a recent change to libpng to reject files containing non-essential chunks greater than 8Mb in size (by default). Unfortunately Adobe Photoshop CS6 can (it seems) generate PNG files with the source graphic embedded inside a very large zTXt chunk, which makes the PNG much larger than necessary and makes libpng reject it.
We will workaround this issue in a future release of Prince by ignoring these chunks. In the meantime, you can use ImageMagick or a similar image processing tool to strip them out, which will have the advantage of greatly reducing the file size.
This issue is fixed in Prince 13.2, available now, thanks for letting us know about the problem!