Advertisement

I am so good, I can load a TGA upside-down!

Started by March 07, 2001 03:42 PM
3 comments, last by Rainmaker 23 years, 8 months ago
Hey, I made a tga loader (thanks tim for that lovely image loading class) which works like a charm- almost. It seems some tgas require flipping, but some dont! I am totally baffled! I may be wrong on this subject tho. I am pretty sure because I used a tga file off the net, and then using psp I edited it. The edited version is flipped incorrectly, but the older one is just right. Is there a way to determine in the file format if it needs to be flipped? Thanks L8r, The Rainmaker BEWARE THE BLACK PROJECT!
Unfortunetly not. Truevision (the people that made the Targa cards, and the TGA format) meant it to be upside down, but not everyone followed that standard. Targa cards store their images upside down, so the TGA format was meant to be more a more "accurate" representasion of what the image would end up being.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
Advertisement
Hi,

You can get the specs for .TGA files from www.wotsit.org and find this out. It''s only one bit (as in an eighth of a byte) that you need to check, and it always occurs in the same place in the file. I don''t have my copy of the specs here though, so I can''t look it up, but it isn''t too hard to find.

In my experience, PaintShop Pro doesn''t entirely stick to the Targa spec anyway. When I wrote my targa exporter I quickly found that PSP doesn''t load targa images with a standard comment field. It''s good enough for most purposes though.

Dan

Dan

PSP (version 7 at least) also saves transparent areas as white in color. This wouldn''t matter most of the time, but sometimes when I stretch images in OpenGL, that white is going to be anti-aliased with the colors bordering it, and give the image a white rim. Photoshop doesn''t do this I am happy to say.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://www.gdarchive.net/druidgames/
The byte right after pixel depth is the image descriptor. Bit 4 is left-to-right ordering and bit 5 is top to bottom ordering.

This topic is closed to new replies.

Advertisement