Page 1 of 1

Having issues with transparency and Mogrify

Posted: 2013-07-01T18:29:34-07:00
by aaron
Hi guys,

I have DDS files with transparency that I need to convert to PNG. I've tried every combination of -alpha, -transparent, -background, etc. but I can't seem to get it right.

Here is the DDS converted to PNG in GIMP
Image

The closest I have come is this, using the command:

Code: Select all

mogrify -alpha set -format PNG24 [filename].dds 
Image

As you can see, the black shirt turns transparent and there are some remaining black pixels around the head that should be transparent.

Or this, using:

Code: Select all

mogrify -alpha set -format PNG32 [filename].dds
Image

This one retains the black shirt, but it looks like crap :|.

Any help? Thanks so much!

Re: Having issues with transparency and Mogrify

Posted: 2013-07-01T18:56:54-07:00
by fmw42
Post a link to your dds file. It is possible that IM only handles binary transparency with DDS.

Try

mogrify -format png [filename].dds

The following works fine for me with a 32-bit tiff file with 8-bit alpha converting to 32-bit png. I have no DDS files and IM only reads them.

# create 8bit transparency
convert logo: -transparent white -channel alpha -blur 0x2 +channel logo.tif
# mogrify
mogrify -format png logo.tif


Also try on one file

convert filename.dds filename.png
or
convert filename.dds PNG32:filename.png

and see if that works OK

I do not think mogrify allows -format PNG32. At least it did not work on my system correctly. It added suffix PNG32 and not just png.

Re: Having issues with transparency and Mogrify

Posted: 2013-07-01T20:46:46-07:00
by aaron
Thanks for the reply!

I tried your suggestion, it gave the same result as my last image. I'm not sure I can share the DDS file, my company is VERY protective of our files.

Re: Having issues with transparency and Mogrify

Posted: 2013-07-01T21:02:50-07:00
by fmw42
aaron wrote:Thanks for the reply!

I tried your suggestion, it gave the same result as my last image. I'm not sure I can share the DDS file, my company is VERY protective of our files.

What about the one you used above? If not that, just create something that you can share that has transparency.