2009.10.14 13:48 "[Tiff] Libtiff Tiff Tag TIFFTAG_STRIPBYTECOUNTS.", by Robert Zermeno

Everyone,
 

I hope someone can come up with a loop around for this.  So, I am trying to programmatically open a Tiff file and read a segment of the image, manipulate it, and spit it out into a new Tiff file.

My question is, my new Tiff file will have a size that is much smaller than the original Tiff image.  I would like to define the TIFFTAG_STRIPBYTECOUNTS count to the size of the new Tiff image height with its values being == to Tiff image width.

My issues I experience is this.  Input Tiff image is of size 1001 x 901 and Output Tiff image is say 300 x 300.  Now, when I perform the operation to only select 300 x 300 pixels out of the 1001 x 901 pixels, the output Tiff image STRIPBYTECOUNT count is == 901 with strip offsets always the value of the new Image width - 100.  So, this case, the value is 200. 

This causes an issue because, I will not be able to see my photo I have created programmatically.  Furthermore, you know that StripOffsets are intertwined with StripByteCounts, so it too has a Count size of == 901 and not 300.

Why did libtiff make it not possible for the user to do a TIFFSetField(outTiff, TIFFTAG_STRIPBYTECOUNTS, ArrayByteCounts) or the same for TIFFTAG_STRIPOFFSETS as well? 

It would be useful to override libtiff computation of these tags for user specifics.  Does anyone know of a loop around to set these fields or maybe have a possible solution to my issue?  If you must see my code, I can supply it a little later on in the day.

 
Thanks to whomever that can enlighten me on this matter,
 
Robert