Search code examples
imagetexturestga

TGA Raw Packet with no size


I exported an image with gimp into a tga image while implementing a parser for tga-textures using rle. A snipped from a hex editor formatted for better understanding:

 (1) 83 06 06 0B FF
 (2) 00 06 06 0A FF
 (3) 83 05 05 09 FF

According to the specs, packet 1 repeats the color 06 06 0B FF (some kind of black) 3 times, because the bits 0-6 of 0x83 equal 3 and bit 7 is the flag for a rle packet. Same with packet 3, 3 times the color 05 05 0 FF. But what does packet 2 mean? because of the missing flag in bit 7 it should be raw packet, but it hasn't any length?! What is the use of a zero size raw packet inside a tga file?

Thanks in advance


Solution

  • After several hours i finally found the solution, the size given inside the packet is -1, so if it says that the size is zero, it means the total size of the packet is 1. Lil' bit tricky but reasonable.