AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2005.06.09 12:49 "TIFF save", by Matthias Lach
2005.06.09 14:55 "Re: TIFF save", by Joris Van Damme
2005.06.09 16:25 "Re: TIFF save", by Michel Salvagniac
2005.06.10 12:33 "WG: [Tiff] TIFF save", by Matthias Lach

2005.06.09 16:25 "Re: TIFF save", by Michel Salvagniac

Hi,

Assuming you can get save or put your image data in a bitmap, this code can 
be helpful (it was for me). I use G4 compression.

var
  BMP:TBitmap;
  imgtif:PTIFF;
  hauteur,largeur : integer;
  resoTiff:double;
  artiste:string;
begin
  artiste:='put your name here'
  resoTiff:=200.0;
  hauteur:=BMP.Height;
  largeur:=BMP.Width;

  imgtif:=TIFFOpen('test.tif', 'w') ;
  TIFFSetField(imgtif, TIFFTAG_IMAGEWIDTH, largeur);
  TIFFSetField(imgtif, TIFFTAG_IMAGELENGTH, hauteur);
  TIFFSetField(imgtif, TIFFTAG_BITSPERSAMPLE, 1);
  TIFFSetField(imgtif, TIFFTAG_SAMPLESPERPIXEL, 1);
  TIFFSetField(imgtif, TIFFTAG_ROWSPERSTRIP, hauteur);

  TIFFSetField(imgtif, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
  TIFFSetField(imgtif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
  TIFFSetField(imgtif, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
  TIFFSetField(imgtif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);

  TIFFSetField(imgtif, TIFFTAG_XRESOLUTION, resoTiff);
  TIFFSetField(imgtif, TIFFTAG_YRESOLUTION, resoTiff);
  TIFFSetField(imgtif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
  TIFFSetField(imgtif, TIFFTAG_SOFTWARE, 'LibTiffDelphi');
  TIFFSetField(imgtif, TIFFTAG_ARTIST, user);

  for y :=0 to hauteur - 1 do
  begin
    TIFFWriteScanline(imgtif,BMP.Scanline[y],y,0) ;
  end;

  TIFFClose(imgtif);
end;

Have fun.
Many thanks to Joris Van Damme and LibTiffDelphi  : ))