I tried to extract a tga image from a vtd-file. It works, but the alpha channel values are incorrect. here's my code:
[pascal]
function TVTDbManager.extractTgaImage(const p_strFileName: String; const p_strOutputFileName : String): Boolean;
VAR
pSource, pRead, pDest: Pointer;
iSourceSize, iTexWidth, iTexHeight, iTexCount, iRes,
iSig, i, j: Integer;
oBmp: TBitmap;
strKey : TRecordKey;
oResultTga : TBitmapEx;
iPatternWidth : Integer;
iPatternHeight : Integer;
begin
Result:= false;
strKey:= FileNameToKey(p_strFileName);
if m_oVTDb.RecordNum[strKey] <> -1 then
begin
iRes:= m_oVTDb.ReadRecord(strKey, pSource, iSourceSize);
if (iRes <> 0) then
begin
Exit;
end;
end;

pRead:= pSource;

// read signature
iSig:= ReadInt(pRead); // record signature
if (iSig <> $58464741) then
begin
FreeMem(pSource);
Exit;
end;

iTexWidth:= ReadInt(pRead); // texture width
iTexHeight:= ReadInt(pRead); // texture height
iPatternWidth:= ReadInt(pRead); // pattern width
iPatternHeight:= ReadInt(pRead); // pattern height
iTexCount:= ReadInt(pRead); // texture count

if (iTexCount < 1) then
begin
FreeMem(pSource);
Exit;
end;

// create preview bitmap
oResultTga:= TBitmapEx.Create();
oResultTga.Width:= iPatternWidth * iTexCount;
oResultTga.Height:= iPatternHeight;
oResultTga.PixelFormat:= pf32bit;

// render all textures to the same image
for i:= 0 to iTexCount - 1 do
begin
oBmp:= TBitmap.Create();
oBmp.Width:= iPatternWidth;
oBmp.Height:= iPatternHeight;
oBmp.PixelFormat:= pf32bit;

// render scanlines
for j:= 0 to iPatternHeight - 1 do
begin
// source image has 24 byte header (which we skip)
// each scanline has 32-bit pixels
pRead:= Pointer(Integer(pSource) + 24 + (j * iTexWidth * 4) + (i * iTexWidth * iTexHeight * 4));
pDest:= oBmp.ScanLine[j];
// move the pixel data to temporary bitmap
Move(pRead^, pDest^, iPatternWidth * 4);
end;

// draw temporary bitmap on preview bitmap
oResultTga.Canvas.Draw(i * iPatternWidth, 0, oBmp);
oBmp.Free();
end;

oResultTga.SaveToFile(p_strOutputFileName);

oResultTga.Free;
Result:= true;

FreeMem(pSource);
end;
[/pascal]