Page 1 of 1
PNG forced to grayscale?
Posted: 2011-02-03T19:34:55-07:00
by Naerymdan
I have a PNG image in RGBA format (The whole TrueColorMatte thing) and try to trim it (and repage it) and save it back as indexed (palette) with:
convert splash.png -trim +repage -type PaletteMatte newSplash.png
convert splash.png -trim +repage -type Palette newSplash.png
convert splash.png -trim +repage -define png:color-type=3 newSplash.png
But it consistently saves it as Grayscale no matter what I use. While it could seem that grayscale is like indexed but with white to black, IT'S NOT! It uses luminance and really plays badly with my rendering engine.
Re: PNG forced to grayscale?
Posted: 2011-02-03T19:46:33-07:00
by fmw42
what IM version and platform? perhaps you need to upgrade.
there have been many changes going on with PNG. see
http://www.imagemagick.org/script/changelog.php
When I tried to do something similar on IM 6.6.7.4 Q16 Mac OSX Tiger, I still get a color image, but the transparency is lost.
convert logo: -resize 50% -transparent white -alpha on -channel rgba -trim +repage -type palettematte PNG8:logo_test.png
or even
convert logo: -resize 50% -transparent white -alpha on -channel rgba -type palettematte PNG8:logo_test.png
or even
convert logo: -transparent white -type palettematte PNG8:logo_test.png
In all 3 cases, the result is still color and palette, but transparency has turned black or is not created leaving white background.
Interestingly, this works:
convert logo: -transparent white gif:- | convert - -type palettematte PNG8:logo_test.png
But this does not:
convert logo: -transparent white miff:- | convert - -type palettematte PNG8:logo_test.png
Re: PNG forced to grayscale?
Posted: 2011-02-04T05:11:37-07:00
by Naerymdan
I'm using the latest and greatest 6.6.7-4, but I had the same problem with my 'old' 6.5.4-7
Re: PNG forced to grayscale?
Posted: 2011-02-04T07:34:29-07:00
by glennrp
Please send the original spash.png to glennrp at imagemagick.org or post a URL to it and I'll see if I can figure out what went wrong.
Verified that fred's last test case fails to preserve the transparency that exists in the MIFF.
Re: PNG forced to grayscale?
Posted: 2011-02-04T10:29:55-07:00
by fmw42
glennrp wrote:
Verified that fred's last test case fails to preserve the transparency that exists in the MIFF.
Glenn,
This does not work either.
convert logo: logo.png
convert logo.png -transparent white -type palettematte PNG8:logo_test.png
Background remains white -- no transparency
Fred
Re: PNG forced to grayscale?
Posted: 2011-02-25T13:02:39-07:00
by glennrp
This was continued in
viewtopic.php?f=3&t=18074
The transparency also gets lost when you write to a MIFF instead of a PNG,
so the bug seems to lie in the palettematte conversion before the encoder is called.