Handle a transparent layer in Targa file
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
How can I handle transparent layer with Targa file in Photoshop ?
Thanks for your help !
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.
Right click on the image layer's thumbnail and choose "Select Pixels".
Go to the channels tab and click "Save selection as channel"() at the bottom of the channels panel.
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.
Duplicate the background layer and delete it because it can't have transparency.
Go to the channels panel and click on the alpha channel.
Click "Load channel as selection"() at the bottom of the channels panel and click on the RGB channel.
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.
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.