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.
PNG forced to grayscale?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG forced to grayscale?
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
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?
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?
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.
Verified that fred's last test case fails to preserve the transparency that exists in the MIFF.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG forced to grayscale?
Glenn,glennrp wrote: Verified that fred's last test case fails to preserve the transparency that exists in the MIFF.
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?
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.
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.