Option -type palette results in output error with some pngs

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Wolfgang16
Posts: 2
Joined: 2017-07-05T15:21:20-07:00
Authentication code: 1151

Option -type palette results in output error with some pngs

Post by Wolfgang16 »

Hello,
I have installed ImageMagick-7.0.6-0-Q8-x64-dll.exe in Windows 7

With 24 bit RGB images as input I get

C:\test>montage -type palette -geometry +0+0 bad.png out.png
montage: image has 0 colors `out.png' @ error/png.c/MagickPNGErrorHandler/1666.

C:\test>convert -type palette bad.png out.png
convert: Valid palette required for paletted images `out.png' @ error/png.c/MagickPNGErrorHandler/1666.

With good.png everthing is fine. out.png is an 8-bit paletted image. Both images are generated in the same way. I can't see any fundamental difference. So whats wrong here?

Since I didn't find any option to attach the image, I have uploaded example.zip them here:
https://1fichier.com/?1qk9uz1pyb
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Option -type palette results in output error with some pngs

Post by glennrp »

Verified that your commands fail. I get reasonable output if I replace "-type palette" with "-colors 255".
I needed to add "-depth 8" to the montage command; otherwise the output was a 48-bit RGB PNG.
Wolfgang16
Posts: 2
Joined: 2017-07-05T15:21:20-07:00
Authentication code: 1151

Re: Option -type palette results in output error with some pngs

Post by Wolfgang16 »

Thanks for your help. The option -colors255 works but I am not sure what -colors255 is intended to do, whether it forces paletted output or whether it simply reduces the number of colors
I need paletted output for saving memory and it should be the same behaviour for png, tif and others.
I also tried version 6.9.8 and got the same errors.
Post Reply