procedure TForm_Scan.Button1Click(Sender: TObject);
var i,R1,R2 : integer;
mFileName,mFileName2,mtest : string;
OpenTiff,OpenTiff2: PTIFF;
buf : pointer;
row, AddRow : integer;
width, height,rows,cols,channels, Photo, BitsPerSam : ^integer;
TileLen, TileWid, rowstrip : ^integer;
begin
mFileName := 'F:\temp\gescannteBilder\BMPTiff1.tiff';
mFileName2 := 'F:\temp\gescannteBilder\BMPTiff2.tiff';
New(rows);
New(cols);
New(channels);
New(Photo);
New(BitsPerSam);
New(TileLen);
New(TileWid);
New(rowstrip);
OpenTiff2 := TIFFOpen(mFileName2,'r');
TIFFGetField(OpenTiff2,TIFFTAG_IMAGELENGTH,rows);
TIFFGetField(OpenTiff2,TIFFTAG_IMAGEWIDTH,cols);
TIFFGetField(OpenTiff2,TIFFTAG_SAMPLESPERPIXEL,channels);
TIFFGetField(OpenTiff2,TIFFTAG_PHOTOMETRIC,Photo);
TIFFGetField(OpenTiff2,TIFFTAG_BITSPERSAMPLE,BitsPerSam);
TIFFGetField(OpenTiff2,TIFFTAG_BITSPERSAMPLE,BitsPerSam);
TIFFGetField(OpenTiff2,TIFFTAG_BITSPERSAMPLE,BitsPerSam);
TIFFGetField(OpenTiff2,TIFFTAG_TILELENGTH,TileLen);
TIFFGetField(OpenTiff2,TIFFTAG_TILEWIDTH,TileWid);
TIFFGetField(OpenTiff2,TIFFTAG_ROWSPERSTRIP,rowstrip);
buf := _TIFFmalloc(TIFFScanlineSize(OpenTiff2));
OpenTiff := TIFFOpen(mFileName,'a');
TIFFSetField(OpenTiff,TIFFTAG_IMAGEWIDTH,cols);
TIFFSetField(OpenTiff,TIFFTAG_IMAGELENGTH,rows);
TIFFSetField(OpenTiff,TIFFTAG_SAMPLESPERPIXEL,channels);
TIFFSetField(OpenTiff,TIFFTAG_PHOTOMETRIC,Photo);
TIFFSetField(OpenTiff,TIFFTAG_BITSPERSAMPLE,BitsPerSam);
TIFFSetField(OpenTiff,TIFFTAG_TILELENGTH,TileLen);
TIFFSetField(OpenTiff,TIFFTAG_TILEWIDTH,TileWid);
TIFFSetField(OpenTiff,TIFFTAG_ROWSPERSTRIP,rowstrip);
TIFFSetField(OpenTiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
row := TIFFScanlineSize(OpenTiff2);
For i := 0 To row - 1 do begin
R1 := LibTiffDelphi.TIFFReadScanline(OpenTiff2,Buf,i,1);
R2 := LibTiffDelphi.TIFFWriteScanline(OpenTiff,Buf,i,1);
end;
TIFFWriteDirectory(OpenTiff);
_TIFFfree(buf);
TIFFClose(OpenTiff);
TIFFClose(OpenTiff2);
Dispose(rows);
Dispose(cols);
Dispose(channels);
Dispose(Photo);
Dispose(BitsPerSam);
Dispose(TileLen);
Dispose(TileWid);
Dispose(rowstrip);
end;