Targa File Help

This is a discussion on Targa File Help within the C++ Programming forums, part of the General Programming Boards category; I have a class that I wrote, (first one that has to do with reading in Binary Files) that is ...

  1. #1
    Registered User jimboob's Avatar
    Join Date
    Jun 2004
    Posts
    40

    Question Targa File Help

    I have a class that I wrote, (first one that has to do with reading in Binary Files) that is meant to read in TRUECOLOR TGA Files. For some reason it is not working and the results come out a bit different than expected. I've tried many different things but still cannot work it out. Any help is appreciated.

    TIA

    (TGA INFO was retrieved from http://www.wotsit.org/download.asp?f=tga2)
    (PLEASE RENAME THE "a.txt" AND "b.txt" extensions to ".tga")
    Attached Files Attached Files

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    There are two things to take into account when loading targa files:

    1) The scan lines goes form bottom to top. The first scanline is the bottom one, the last is the top one.

    2) The colors are stored as BGR or BGRA, not RGB or RGBA. Solve this by doing std::swap on the first and third byte in the pixel.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  2. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21