Free Image TGA saving

BlitzMax Forums/Brucey's Modules/Free Image TGA saving

Pete Rigz(Posted 2011) [#1]
Hello, can you save TGA's with alpha? My attempts seem to result in no alpha channel. I just tested with the test example using a png file; saving back as a png is fine, but tga loses the alpha channel...



Thanks in advance! :)


Brucey(Posted 2011) [#2]
Yes. Your example works for me :-)

I loaded a png with alpha channel, then saved it as tga, loaded it back in, and it has an alpha channel. (i.e. the background is see-thru)

Your image needs to be 32bit when you save the tga, btw.

Here's the image with a white rect drawn behind :


Last edited 2011


Pete Rigz(Posted 2011) [#3]
Hmm, not working here, you sure that's working? Blitz usually treats black as alpha when loading in images, so you need to test with an image with semi transparent pixels, or load it into Photoshop or something and check there:

Can you test with this:



Thanks for looking into it! :)


Brucey(Posted 2011) [#4]
Yes, it works fine in your example too.

I should also point out, you need to SetBlend alphablend to see the alpha properly, otherwise it's just drawing it in your example as either on or off.

Here's the code

and screenshot :


Last edited 2011

Last edited 2011


Brucey(Posted 2011) [#5]
Your explosions look really good, btw :-)


Pete Rigz(Posted 2011) [#6]
Yeah i take it all back, looking again in Photoshop I see there is an alpha channel with the image, I'm too used to the way PNG files load into photoshop and show the transparency in the window (with the grey and white checker board).

Thanks for the help (and compliment on the explosions!) :)