POV-Ray : Newsgroups : povray.general : hacking TARGA the easy way : Re: hacking TARGA the easy way Server Time
9 Aug 2024 03:22:06 EDT (-0400)
  Re: hacking TARGA the easy way  
From: Matt Giwer
Date: 29 Aug 2000 19:30:55
Message: <39AC4829.1693F3C@ij.net>
Christoph Hormann wrote:
> 
> Warp wrote:
> >
> >   The raw targa file format outputted by povray is extremely simple. It has
> > 18 bytes of header data at the beginning and then the image follows as raw
> > data. I don't remember which pair of 16 bits of the header data tells the
> > dimensions of the image but that should be easy to discover (either by
> > lookin it up in some spec or by examining the header directly with a
> > hex editor (and knowing the dimensions of the image)).
> >
> 
> As i already posted in p.b.i some time ago, the tga header has the following
> form (pascal/delphi syntax):
> 
>    T_TGA_header = packed record
>     ID_size: Byte;            { ID-Field                   }
>     Palette: Byte;            { 1= Palette exists          }
>     Typ: Byte;                { Type (Mono, Color, compr.) }
>     Pal_index: Word;
>     Pal_size: Word;
>     Pal_entry_size: Byte;
>     Lx    : Word;
>     Ly    : Word;
>     cX    : Word;             { Width                      }
>     cY    : Word;             { Height                     }
>     Bppix : Byte;             { Bits per Pixel - 1, 8, 24  }
>     Image_des: Byte;          { Image Descriptor Flag      }
>    end;
> 
> If Palette is 1 this if followed by a 3x256 byte palette of rgb triples.

	Triples in the order B G R. 

> Otherwise only the raw data array is appended (RLE compression in some cases,
> but that should not be neccessary here).

-- 
Pat Buchanan or the American Empire of Earth.
The choice is yours. 
	-- The Iron Webmaster, 43


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.