2004.10.25 17:17 "[Tiff] Read a compressed tiff with G4", by Elzumba Sefue

2004.10.26 04:02 "Re: [Tiff] Read a compressed tiff with G4", by Andrey Kiselev

Yes, I read with TIFFReadEncodedStrip, but the buffer of result not have the same pixels that the image have (height x width).

But in the case of G4 compression you are deal with the 1-bit monocrome image. Pixels are packed in bytes (8 pixels per byte).

int CC(char *strFileName) {
TIFF* tif = TIFFOpen(strFileName, "r");
TIFF* tif2 = TIFFOpen("C:\\2.tif", "w");
if (tif) {
char* buf;
tstrip_t strip;
uint32* bc,c,w,p,h,bps,photo,spp,*rps,ru;
uint32 stripsize;
unsigned long i;

TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &bc);

You don't need that tag at all. You will get the sizes of compressed strips, but that is not what you need. You should calculate the buffer size yourself, based on the Width, RowsPerStrip, SamplesPerPixels and BitsPerSample tags.

Andrey

Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517