Advertisement


Handle a transparent layer in Targa file


Question

I need to create some Targa file in order to load them in OpenGL (I can only use .tga ..). I created my images on Photoshop, I set a transparent background but when I save my file it's totaly opaque.

The black layer is at 98% opacity

The black layer is at 98% opacity

How can I handle transparent layer with Targa file in Photoshop ?

Thanks for your help !

EDIT :

The channels :

2015/05/16
1
3
5/16/2015 1:57:00 PM

The Targa file format doesn't store transparency in the same way as formats such as png so it needs to have an alpha channel which is a component of an image which describes how transparent each pixel is, with transparent being 100% black and opaque being 100% white and anything in between is semi-transparent.

To make an alpha channel from the standard transparency, you can do the following.

Note: This is how it's done in windows as I'm not too familiar with Mac so I have avoided shortcuts where possible.

  1. Right click on the image layer's thumbnail and choose "Select Pixels".

  2. Go to the channels tab and click "Save selection as channel"(Save selection as channel) at the bottom of the channels panel.

  3. Make sure you save the tga with the 32 bits/pixel resolution option to save it with the alpha channel.

When the file is saved as a tga and opened again in Photoshop, it will look opaque, but the alpha channel is still there so the inverse of the the process above is the following.

  1. Duplicate the background layer and delete it because it can't have transparency.

  2. Go to the channels panel and click on the alpha channel.

  3. Click "Load channel as selection"(Load channel as selection) at the bottom of the channels panel and click on the RGB channel.

  4. Go back to the layers panel and invert the selected area by going to Select->Inverse. you might get a warning but it's fine.

  5. Delete the selection and deselect everything by going to Select->Deselect and what remains is the image with the transparency showing.

There are other methods of doing this, but this one seems fairly simple.

2015/06/17
2
6/17/2015 6:25:00 PM