2004.03.05 11:22 "[Tiff] Reading a bilevel inage", by Salil Khanwalkar

2004.03.05 14:00 "Re: [Tiff] Reading a bilevel inage", by Frank Warmerdam

Can somebody help me in displaying a bilevel image. Please tell me which functions should i read.


Are you sure you have went through the documentation sufficiently before asking such a general and open ended question?

Looking through the "Using The TIFF Library" page at:


There are simple examples of accessing TIFF files using libtiff. For example the first scanline example is pretty straight forward:

#include "tiffio.h"
     TIFF* tif = TIFFOpen("myfile.tif", "r");
     if (tif) {
  uint32 imagelength;
     tdata_t buf;
    uint32 row;

     TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
   buf = _TIFFmalloc(TIFFScanlineSize(tif));
       for (row = 0; row < imagelength; row++)
     TIFFReadScanline(tif, buf, row);

The pixel values will be bit packed in the "buf" buffer.

There is also some excellent tutorial material available from IBM DeveloperWrks on using libtiff. Also linked on the "Using The TIFF Library" page.

I would suggest you experiment and then ask a focused question.

As you might imagine, there is nothing us free software maintainers like less than someone essentially saying "tell me how to do my job, I am not willing to take the time to even read your documentation and experiment first".

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent