TGA files

BlitzMax Forums/BlitzMax Programming/TGA files

Warren(Posted 2004) [#1]
Has anyone successfully loaded a TGA file in BlitzMax? I have yet to make it work ... it always returns NULL from LoadImage. It can load a PNG version of the same file just fine...

I tried with and without RLE compression.

I really don't know where to go from here... What's the secret to creating usable TGA files in Photoshop?


dangerdave(Posted 2004) [#2]
From the notes of the tga loader:

By including the TGA loader module in your projects, the LoadPixmap command will be able to detect and load TGA format images.


I guess it is not auotmatically imported?
I'm not able to test at this time.

(looking in the mod source, 16bit & 32bit versions include alpha, and 15bit & 24bit don't. makes sense.)


Warren(Posted 2004) [#3]
The issue is kind of weird. I stepped through the TGA loading code and it reads the header out of the TGA file and everything looks to be set correctly, except for width and height which are both set to 1. The loader sees this and bails out, returning NULL.

I don't know if this is Blitz Research not defining the tga header structure properly or if Photoshop is saving out illegal TGA files...


dangerdave(Posted 2004) [#4]
I don't have photoshop.
Seems that ver. 7 makes better tga files when in comes to alpha. The previous versions convert alpha areas to white.

I loaded a tga file from a blitz3d project and loaded it with the makpaint demo.
I loaded fine. However, I'm not sure of the bit depth and if it had any alpha.
The makpaint demo seems to convert the pixmap to a rgba8888 format.


dangerdave(Posted 2004) [#5]
Actually, the coloring seems off compared to other viewers.