Closed tresf closed 9 years ago
The bugs seems to be specific to Java, Mac and the image format, which is a 1-bit
Grayscale PNG image.
A work-around is to use ImageMagic to perform image conversion and forcing the PNG color-type property to zero, which bumps the 1-bit
to 8-bit
and prevents the crash from occurring via -define png:color-type=0
. This has the benefit of maintaining the grayscale palette, but a downside of doubling the image size (e.g. 13KB to 26KB)
convert original-1-bit.png -define png:color-type=0 fixed-8-bit.png
This issue was with OS X 10.10 but not 10.9.5. It only happens with images that had a palette smaller than 16 colors, or a 4 bit pixel data size.
The fix was to take the palette out and putting it in a 256 color buffered image we can pad out the palette to 8 bits without introducing dithering. Note: If any dithering DOES happen it is due to the strangeness of Java and not the palette.
After the fix we had a similar issue with a full ARBG image that had a BufferedImage.getType()
of TYPE_CUSTOM
, crash. If any more images crash, log their type, look up the enum in the constant-values section of JavaDocs, then add it to the badTypes
array.
The attached image crashes QZ Tray out completely with a Mac stacktrace when printed using qz.appendImage().