Page 1 of 1

PNG Transparency Bug (mogrify)

Posted: 2012-03-01T00:37:07-07:00
by redkahuna
version: ImageMagick-6.7.5-7-Q16-windows-dll.exe

Small PNG 32bit images that only have greyscale colors with full 8bit alpha will not convert without loosing the alpha layer when using mogrify while convert still works.

"convert pngalpha.png -transparent none -resize 50% PNG32:pngalpha.png"
resulting in proper 32bit 50% scaled iamge

"mogrify pngalpha.png -transparent none -resize 50% PNG32:pngalpha.png"
resulting in proper 8 bit image index color

I spend hours trying everything to get mogrify to work but with no success. :(

Re: PNG Transparency Bug (mogrify)

Posted: 2012-03-01T06:15:57-07:00
by glennrp
redkahuna wrote: "mogrify pngalpha.png -transparent none -resize 50% PNG32:pngalpha.png"
resulting in proper 8 bit image index color
The first "pngalpha.png" in this command shouldn't be there. Removing it does
not help, though. This works (using -format PNG32 instead of the PNG32: prefix):

Code: Select all

mogrify -transparent none -resize 50% -format PNG32 pngalpha.png
I don't know if it's a bug or just the way things are.

Re: PNG Transparency Bug (mogrify)

Posted: 2012-03-01T09:29:31-07:00
by redkahuna
Thanks gleenrp,
It creates the correct image properties but now I need a way to truncate the name on output.

Code: Select all

mogrify -transparent none -resize 50% -format PNG32 pngalpha--large.png
file result: pngalpha--large.PNG32

Is there a way to change the extension back to lowercase .png (not .PNG32) and truncate the name to pngalpha.png?

Also another bug exists where using this in a resize.bat dos script it will remove the resize % argument and turn it into a pixel width instead?

Re: PNG Transparency Bug (mogrify)

Posted: 2012-03-01T15:33:53-07:00
by glennrp
redkahuna wrote: Is there a way to change the extension back to lowercase .png (not .PNG32)
In recent versions (6.7.3-0 and later) you can use "-define png:format=png32" instead of "-format png32" and that does not change the extension.

Re: PNG Transparency Bug (mogrify)

Posted: 2012-03-01T16:35:49-07:00
by redkahuna
Thanks glennrp!

Re: PNG Transparency Bug (mogrify)

Posted: 2012-08-01T13:02:06-07:00
by Ipsquiggle
So even though glennrp helpfully provided a workaround, this is still a glaring bug (using 6.7.8-5).

I can't imagine any circumstance where I would want mogrify to change the format of my image without me explicitly saying so, or unless an operation requires it (e.g. adding an alpha channel to a BMP24 could reasonably convert it to a BMP32). That is to say, this may be a more systemic issue than just the PNG32 case.

It's pretty weird to have to tell mogrify "Yeah, crop this png, oh and by the way, don't trash most of the information in the image, thanks."

Especially since it's already (apprently) working correctly with convert!

Thanks