Converting PNG with transparency to TGA with transparency

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
WGH
Posts: 5
Joined: 2014-01-24T12:07:00-07:00
Authentication code: 6789

Converting PNG with transparency to TGA with transparency

Post by WGH »

Hello.

I might be missing some obvious option, but I'm having trouble converting PNG with transparency to TGA with transparency.

Calling 'convert test.png test.tga' gives some weird image. I tried to convert it to GIF, just to be sure, and ImageMagick gave me correct result.

png-tga-gif comparison screenshot
Image

test.png
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting PNG with transparency to TGA with transparenc

Post by fmw42 »

this seems to work for me on IM 6.8.8.2 Q16 Mac OSX


convert 1390591139-nO.png -alpha on -channel rgba 1390591139-nO.tga
WGH
Posts: 5
Joined: 2014-01-24T12:07:00-07:00
Authentication code: 6789

Re: Converting PNG with transparency to TGA with transparenc

Post by WGH »

My apologies. It was Photoshop not supporting it. ImageMagick was doing it right (even without additional options).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting PNG with transparency to TGA with transparenc

Post by fmw42 »

The difference is that PS interprets the PNG transparency as Background transparency. But it interprets the TGA transparency as an alpha channel. If you look at the channels in both images in PS you will see that both have transparency, just different kinds. I suspect that TGA does not support background transparency, but does support alpha channel transparency. However, I am no expert on either PS or TGA format.
WGH
Posts: 5
Joined: 2014-01-24T12:07:00-07:00
Authentication code: 6789

Re: Converting PNG with transparency to TGA with transparenc

Post by WGH »

You're right.

Honestly though, I don't really get the difference between alpha channel and transparency here. In both PNG and TGA there's only one one alpha channel - it's just RGBA color space after all. Why does Photoshop interpret them differently? I have no idea.

I guess alpha channel (as opposed to transparency) makes sense in more complex formats, where there can be many of them.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting PNG with transparency to TGA with transparenc

Post by fmw42 »

Pretty much only PS uses background transparency.
Post Reply