CompuServe Thread

#Targa Files upside down

2 messages in this thread
#2893From: Steven . FuitenFeb 14, 1995 1:32 AM
How come my files come out upside down in one program and not another? also anyone want to write some c code for accessing scsi devices. Drivers and Headers already created. Please contact if interested.
#2950From: Steve BrowningFeb 15, 1995 1:54 PM
>>How come my files come out upside down in one program and not another?<<< It's due to an unfortunate lack of detail in the TGA specification. In field 5 of the TGA header there is a byte called the Image Descriptor that contains two bits that define the image origin. The spec states that these bits are used to indicate the order in which pixel data is transferred from the file to the screen. The value 00 specifies bottom left and is typical of images created on a TARGA board. These bits can be other values specifying bottom right, top left, and top right, but in some cases the applications simply ignore the bits and load the first data in the file at the lowest memory address of the display buffer. The other reason for image inversion occurs when TGA files are moved between other display boards and TARGA environments (particularly noticable between Mac and PC). While most frame buffers designate the upper left corner of the display as the origin, the TARGA did not (its origin is the lower left which happens to equate to the lowest address of the frame buffer – the memory scanning circuitry took care of the headaches). That leaves the TGA spec open to interpretation since it does not specifically reference the TARGA board. One solution is to get a copy of the TGA Utilities from Truevision (1-800-SAY-COLOR) and use them to edit the image descriptor byte so that your application can load it correctly (or get your application developer to include an inversion option when reading in the image). Steve Browning