TIFF and LibTiff Mail List Archive


2001.05.02 12:45 "Pixel Raster (DIB) into TIFF G4", by Wolfram Bettermann
2001.05.02 13:30 "Re: Pixel Raster (DIB) into TIFF G4", by Frank Warmerdam

2001.05.02 13:30 "Re: Pixel Raster (DIB) into TIFF G4", by Frank Warmerdam

I have tried to convert this packed raster into a TIFF G4 using TIFFWriteEncodedSTrip, but do get an error message that the ImageLength is not set (altough I did with TIFFSetField) but was not sure how to tell libtiff where this raster buffer resides.


You will likely have to provide the relvent section of code for us to see to answer this.

My question is, do I first have to unpack the bytes that 1 pixel (1bit) is in ne byte (so width is now really one pixel per byte) and then pass this buffer to libtiff using WriteEncodedStrip? And if yes, how do I pass this raster buffer to the libtiff?

No, if you setup output with BITSPERSAMPLE set to 1, you will want to keep your bitmap packed eight pixels per byte. However, the 32bit alignment of scanlines will be a problem. I believe that the buffer passed to TIFFWriteEncodedStrip() expects the buffer to be tightly packed (no extra space for alignment between scanlines), so if you width isn't a multiple of 32 you will have to repack the bitmap before passing to TIFFWriteEncodedStrip.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam,
light and sound - activate the windows |
and watch the world go round - Rush    | Geospatial Programmer for Rent