16bit tga

Started by
2 comments, last by Zeke 22 years, 1 month ago
Are 16bit tga files colormapped? Im trying to convert from a 24bit custom format to a 16 bit targa. I write the header out and then write each pixel (converting each rgb value from the custom format to a WORD for the tga). The picture is visible and correst however the colors have gone loopy, its very grainy with weird colour all over the place, incidentally my transparent color comes out perfectly (255,0,255). Its not just a case of getting the red and blue values mixed up as ive done that before and this pic is nothing like that (plus i have tried inverting the r,b values). Does this grainy flourescent colors for a 16 bit tga sound familiar to anyone? Ive been to wotsit.org and got the spec for tga files and although i dont actually understand most of it (hehe) i kind of got the idea that 16bit tga''s use a colormap but if that is the case why am i able to see my tga picture but with crazy colors? If anyone can help id be very grateful. p.s. I havent posted any code because Im just wondering if this sounds familiar to anyone, but if you need more info and code im more than happy to post it. Thanks for any help
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Advertisement
Hey,

As the spec on wotsit.org says, TGAs come in both colourmapped and non-colourmapped formats.

Without colourmapping, it''s really simple. There''s a header of 18 bytes, then a straight dump of the pixels (going from the bottom up mind you!) with 2 bytes per pixel.

It might seem like a weird place to look, but the creator of a WindowsCE game development wrapper called EasyCE has a tutorial that explains loading in 16-bit TGA files. His website is here. The information is in Tutorial 2. Remember that his code is written for CE, and might not work in Win32.

Hope that helps!

Trevize
Thanks for the reply. Im trying to write the file without colormapping (i.e. doing just as you say- a header and then straight dump of pixels) but the colors are just messed up.

Thanks for the link ill take a look
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Thanks very much that tutorial helped. It turns out that 16 bit tga's are actually 15 bit with 1 bit alpha channel. Once the tutorial explained that I was able to fix my code to convert it properly.

Thanks very much

Edited by - Zeke on February 20, 2002 5:54:55 AM
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face

This topic is closed to new replies.

Advertisement