Page 1 of 1

Option -type palette results in output error with some pngs

Posted: 2017-07-06T04:14:05-07:00
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

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

Posted: 2017-07-13T10:21:13-07:00
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.

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

Posted: 2017-07-22T08:24:05-07:00
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.