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
December 2009

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!



Thread

2009.12.07 16:06 "Problems with multiple strip G4 to single strip G4 tiff.", by Phillip Wiles
2009.12.08 17:53 "Re: Problems with multiple strip G4 to single strip G4 tiff.", by Phillip Wiles
2009.12.08 18:11 "Re: Problems with multiple strip G4 to single strip G4 tiff.", by Juergen Buchmueller
2009.12.09 07:47 "Re: Problems with multiple strip G4 to single strip G4 tiff.", by Phillip Wiles
2009.12.09 08:11 "Re: Problems with multiple strip G4 to single strip G4 tiff.", by Juergen Buchmueller

2009.12.08 17:53 "Re: Problems with multiple strip G4 to single strip G4 tiff.", by Phillip Wiles

Phillip wrote:

>
> If I use this below to write a tiff that started as single strip tiff,
> there is no problem. But when I try to write an image that started out
> as multiple strips it crashes. Do I "need" to save the image multiple
> strips? And if I do, can someone help in the right direction (I have
> experimented to try and force multiple strips with a group 4 image, with no
> luck).
>
> TIFFSetField(out,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
> if(mbCompression){TIFFSetField(tif, TIFFTAG_COMPRESSION,
> mTiffCompression);};
> if(mbSubfileType){TIFFSetField(tif, TIFFTAG_SUBFILETYPE,
> muliSubfileType);};
> if(mbResolutionUnit){TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT,
> musiResolutionUnit);};
> if(mbXResolution){TIFFSetField(tif, TIFFTAG_XRESOLUTION,
> mfTiffXresolution);};
> if(mbYResolution){TIFFSetField(tif, TIFFTAG_YRESOLUTION,
> mfTiffYresolution);};
> if(mbImageWidth){TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, muliImageWidth);};
> if(mbImageLength){TIFFSetField(tif, TIFFTAG_IMAGELENGTH,
> muliImageHeight);};
> if(mbPhotometricInterpretation){TIFFSetField(tif, TIFFTAG_PHOTOMETRIC
> ,musiPhotoMetric);};
> if(mbBitsPerSample){TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE
> ,musiBitPerSample);};
> if(mbFillOrder){TIFFSetField(tif, TIFFTAG_FILLORDER, musiFillOrder);};
> if(mbSamplesPerPixel){TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
> musiSamplePerPixel);};
>
> if(mbuf){TIFFWriteEncodedStrip(tif, 0, mbuf, (muliImageWidth *
> muliImageHeight) / 8);};
> //My attempt at creating multiple strip.
> //if(mbRowsPerStrip){TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP,
> muliRowsPerStrip);};
> //tdata_t outbuf;
> //char * p = (char*)mbuf;
> //for(tstrip_t counter = 0; counter < mstrip; counter++){
> //   outbuf = (void*)&p[counter * (muliImageWidth * muliRowsPerStrip)/8];
> //   TIFFWriteEncodedStrip(out, counter, outbuf, (muliImageWidth *
> muliRowsPerStrip)/8);
> //};
>
>
 I have changed the save to:
if(mbuf){TIFFWriteEncodedStrip(out, 0, mbuf, mBufferSize);};
This gives me a black (or all white depending on program used to read
it) image as output from a multiple strip original image. A single strip
original image still works without problems. Both images are Group 4 (I can
post the data from AsTiffTagViewer, if that will help any).

This is my read (which is for the most part the same as the one shown in the
"Using the TIFF Library")
mstrip = TIFFNumberOfStrips(tif);
mBufferSize = TIFFStripSize(tif);
mbuf = _TIFFmalloc(mBufferSize);
mstrip = TIFFNumberOfStrips(tif);
for (tstrip_t tempstrip = 0; tempstrip < mstrip; tempstrip++){
 TIFFReadEncodedStrip(tif, tempstrip, mbuf, (tsize_t) -1);
};

I'm using LibTIFF 3.8.2