2005.04.17 06:12 "[Tiff] How do I access the data once I use TIFFReadEncodedStrip?", by Phillip Wiles
I'm using a small sample tiff (that is Group 3 compressed) and would like to get it to display out in window as: 00000111000 Which gives me this:
c:\main.cpp(30) : error C2036: 'void *' : unknown size
c:\main.cpp(30) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
Is it because I'm trying to use std::cout calls, or am I completely not understanding how buf works?
int main(int nArg, char* pszArgs[]){
TIFF *tif=TIFFOpen("smile.tif", "r");
if (tif) {
tdata_t buf;
tstrip_t strip;
buf = _TIFFmalloc(TIFFStripSize(tif));
for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++)
{
TIFFReadEncodedStrip(tif, strip, buf, (tsize_t) -1);
}
// Begin my code that doesn't work.
unsigned int width;
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
unsigned int height;
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
for (unsigned int x = 0; x < width; x++){
for (unsigned int y = 0; y < height; y++){
std::cout << buf[x + (height * y)];
}
std::cout << "\n";
}
_TIFFfree(buf);
TIFFClose(tif);
}
return 0;
}
SubFileType (1 Long): Zero
ImageWidth (1 Short): 40
ImageLength (1 Short): 40
BitsPerSample (1 Short): 1
Compression (1 Short): Group 3 Fax (aka CCITT FAX3)
Photometric (1 Short): MinIsBlack
StripOffsets (1 Long): 44
SamplesPerPixel (1 Short): 1
RowsPerStrip (1 Long): 40
StripByteCounts (1 Long): 158
XResolution (1 Rational): 300
YResolution (1 Rational): 300
Group3Options (1 Long): 0
ResolutionUnit (1 Short): Inch
DateTime (20 ASCII): 2005:04:17 09:32:23