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
November 2001

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!



2001.11.08 04:32 "using TIFFWriteScanline", by Bryce Loughnan

Hi 

I'm trying to make an 8 bit grayscale tiff using TIFFWriteScanline. I'm not
sure what I'm doing wrong.
I'm unsure about rowsperstrip. I have read through the docs, specs and
examples. But I don't seem to get it.

Hopefully this is trivial to someone out there.
Any help would be great!

thanx

bryce 


{
  uint32 w = 100;
  uint32 h = 100;
  uint16 spp = 1;
  uint16 photometric = PHOTOMETRIC_MINISBLACK;
  uint16 compression = COMPRESSION_NONE;

  TIFF* out = TIFFOpen("output.tif", "w");

  TIFFSetField(out, TIFFTAG_IMAGEWIDTH,  w);
  TIFFSetField(out, TIFFTAG_IMAGELENGTH, h);
  TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
  TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, spp);
  TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
  TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  TIFFSetField(out, TIFFTAG_PHOTOMETRIC, 1);
  TIFFSetField(out, TIFFTAG_COMPRESSION, compression);

  TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, 1);

  TIFFSetField(out, TIFFTAG_XRESOLUTION, 1);
  TIFFSetField(out, TIFFTAG_YRESOLUTION, 1);
  TIFFSetField(out, TIFFTAG_RESOLUTIONUNIT, 3);


   unsigned char values[100];
 
  int i;

  for(i=0; i < 100; i++)
   values[i]= 255;
  //values[i]= 100;

  for (i=0; i < 100; i++)
  {
   TIFFWriteScanline(out, values, h, 0);
  }

  TIFFClose(out);
 }





Download your free MojoWorld Transporter today
http://www.pandromeda.com/get_transporter