Page 1 of 1

PNG color is wrong but GIF is right

Posted: 2012-06-26T03:10:19-07:00
by Santa911
Hi, I'm trying to make some small icons with a certaing HEX color. It works quite well for most of the hex codes I have processed, but for the hex color "FFCC00" it does not work, when I converts it to PNG. However the "same" code works for GIF formats.

Why is that - Can somebody explain this and hopefully help me converting to right color for PNG?

GIF - Works fine (turns yellow)

Code: Select all

convert -size 30x24 canvas:#ffcc00 Box0030x0024_FFCC00.gif
PNG - Does not work (turns black)

Code: Select all

convert -size 30x24 canvas:#ffcc00 Box0030x0024_FFCC00.png
PS. What is the difference when using "canvas" instead of "xc". Both things works on the above.

Lars

Re: PNG color is wrong but GIF is right

Posted: 2012-06-26T10:03:15-07:00
by fmw42
There have been some colorspace changes going on since IM 6.7.5.5 that may only now have been fully resolved. You don't say what release you are using. So you may want to upgrade to the latest release and give that a try.

canvas: and xc: are the same thing (just a name change as xc: was not as descriptive as canvas:) both are still valid

Re: PNG color is wrong but GIF is right

Posted: 2012-06-26T11:32:56-07:00
by Santa911
Thanx. I am using Win7 and have been using the latest version (ImageMagick-6.7.7-9-Q16-windows-dll.exe). Maybe I should downgrade instead :shock:

If you are uncertain you can self give it a try with the code descriped - it's only one commandline to test (twice) but with a different result.

Lars

Re: PNG color is wrong but GIF is right

Posted: 2012-06-26T11:52:12-07:00
by fmw42
I am using IM 6.7.7.9 Q16 (hdri) Mac OSX Snow Leopard and your two commands produce exactly the same results for me. Might it be your viewer?

Perhaps it is a Windows issue? Maybe one of the other Windows users could verify and report back.

Re: PNG color is wrong but GIF is right

Posted: 2012-06-26T18:00:08-07:00
by anthony
The image turning black is a serious bug of some kind.
It should not happen.

Re: PNG color is wrong but GIF is right

Posted: 2012-06-27T06:44:13-07:00
by glennrp
The PNG encoder was not expanding the PLTE chunk to accommodate the background color in indexed PNG output. Fixed in IM-6.7.7-10, SVN revision 8520 and 8521.

Re: PNG color is wrong but GIF is right

Posted: 2012-06-27T23:31:17-07:00
by Santa911
Sounds good with the fix in version 6.7.7-10, but on the webpage the newest version is still ImageMagick-6.7.7-9 (2012-06-28). Any idea on when the new version for Windows is released?

Lars

Re: PNG color is wrong but GIF is right

Posted: 2012-06-28T06:08:11-07:00
by glennrp
IM-6.7.7-10 is out today 28 June.

Re: PNG color is wrong but GIF is right

Posted: 2012-06-29T02:38:16-07:00
by Santa911
Nope, does still not work in version 10 (ImageMagick-6.7.7-10-Q16-windows-dll.exe). Following command still creates a black rectangle :(

Code: Select all

convert -size 30x24 canvas:#ffcc00 Box0030x0024_FFCC00.png
Hope that this will be fixed in future versions.

Lars

Re: PNG color is wrong but GIF is right

Posted: 2012-06-29T08:34:10-07:00
by glennrp
Some of the IM-6.7.7-10 Windows executables at SourceForge were built a few minutes
before the PNG patch was applied. I did not notice that problem until this morning.
The IM-6.7.7-10 executables at SourceForge are up to date now.

Re: PNG color is wrong but GIF is right

Posted: 2012-06-29T11:26:27-07:00
by Santa911
Thanx - Now it works, you're help is appreciated. Great program by the way. Combined with programming I find it find a very useful tool for smaller tasks ex Watermarks and generation of icons etc.

Lars