AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
February 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



2006.02.09 16:22 "Are pages hidden in Fax Viewers?", by <byagc@hotmail.com>

Hi Friends!

My Multi-Page Tiff files with more than a page are read normally in tiff
readers (e.g. ACDSee), however, in fax viewer, are shown as having only one
page. What it can be wrong?

I use: LibbTiffDelphi - Delphi/Pascal - Win32 - P%B.
 
my code is:
 
function InsertBitmap(Bitmap: TBitmap; Arq: string; ScanMode: TScanMode): Word;
var
  Ftile: Cardinal;
  Row: Cardinal;
  FWidth, FHeight: Cardinal;
  iResUnit: Cardinal;
  iRowsPerStrip, fXRes, fYRes: Cardinal;
  FnPages: Word;
begin
  //CloseTiffFile;
  if ScanMode = smNew then
    TiffLoadFromFile(Arq, 'w')
  else
    TiffLoadFromFile(Arq, 'a');
 
 
  FHeight := Bitmap.Height;
  FWidth := Bitmap.Width;
  fXRes := 150;
  fYRes := 150; 
  iRowsPerStrip := FHeight; // 2800  TIFFDefaultStripSize(ScanTiff, 0)
 
  TIFFSetField(OpenTiff, TIFFTAG_IMAGEWIDTH, FWidth);
  TIFFSetField(OpenTiff, TIFFTAG_IMAGELENGTH, FHeight);
  TIFFSetField(OpenTiff, TIFFTAG_BITSPERSAMPLE, 1);
  TIFFSetField(OpenTiff, TIFFTAG_SAMPLESPERPIXEL, 1);
  TIFFSetField(OpenTiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  TIFFSetField(OpenTiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
  TIFFSetField(OpenTiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
  TIFFSetField(OpenTiff, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
  TIFFSetField(OpenTiff, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); 
  TIFFSetField(OpenTiff, TIFFTAG_GROUP4OPTIONS, 0);
  TIFFSetField(OpenTiff, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE);
  TIFFSetField(OpenTiff, TIFFTAG_FAXMODE, FAXMODE_CLASSIC);
  TIFFSetField(OpenTiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT
  TIFFSetField(OpenTiff, TIFFTAG_ROWSPERSTRIP, iRowsPerStrip);
  TIFFSetField(OpenTiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
  TIFFSetField(OpenTiff, TIFFTAG_XRESOLUTION, fXRes);
  TIFFSetField(OpenTiff, TIFFTAG_YRESOLUTION, fYRes);
  TIFFSetField(OpenTiff, TIFFTAG_STRIPBYTECOUNTS, 118352);

  FnPages := TIFFNumberOfDirectories(OpenTiff) + 1;
  TIFFSetField(OpenTiff, TIFFTAG_PAGENUMBER, FnPages);
  Result := FnPages;
 

  Row := FHeight;
  for Row := 0 to FHeight - 1 do
  begin
    TIFFWriteScanline(OpenTiff, Bitmap.ScanLine[Row], Row, 0);
  end;
 

  CloseTiffFile();
end;


Arlon Gesiel Cardoso