Thanks for the reply!
Probably I have not been clear enough. It’s not me who needs to read those files. I need to write code which would allow our customers to read such files. Of course, I could write code which replaces libtiff and parses the file by itself, and I have done so in the past (for limited variations of the TIFF zoo), and BTW that’s how I know that the second half of the array is really there. It’s just that we are aiming to use libtiff in the production instead of homegrown code. In general we have been able to coerce it into doing what we want in the past, so we were hoping this is the case also now. Basically all we need is the offset of the raw array in the file. Regards Paavo From: Rob Tillaart <[email protected]> Sent: teisipäev, 5. aprill 2022 17:49 To: [email protected] Cc: Tiff List <[email protected]> Subject: Re: [Tiff] Reading miscoded custom field array via libtiff Before anything else make a working copy of the file. This is what I would do Find a hexeditor and try to verify if the missing data is indeed in the file. (Can it be overwritten by other tags etc? ) If the file contains the data you might be able to patch the length in the appropriate tag with the hexeditor. Or you might need to adjust the size 8 16 32 bit, if the error is not in the length. If patching does not work you might need to extract the data e.g. with a python script. Find begin end of the array and write it as binary or convert to CSV whatever suits. On Tue, 5 Apr 2022, 15:34 , <[email protected] <mailto:[email protected]> > wrote: Hi libtiff gurus, I have stuck on a nasty problem. We need to add support for reading some proprietary TIFF files containing some binary integer arrays in custom extension tags. The problem is they have not followed the TIFF standard for encoding the array length and thus the arrays are actually twice longer in the file than is known to libtiff, so when I read them in I only get first half of the array. No problem, I thought: I get the value count and pointer to raw data out of the TIFFGetField(), and then just multiply this value count by 2 before reading in the raw data array. Alas, this does not work, it appears libtiff has copied the array away somewhere else, so I get just garbage if I attempt to read more than the official length. Hence my question: is it possible to somehow read in twice the data from the original array location inside the file, or to otherwise convince libtiff somehow that the array is twice larger than encoded in the IFD entry? TIA Paavo _______________________________________________ Tiff mailing list [email protected] <mailto:[email protected]> https://lists.osgeo.org/mailman/listinfo/tiff
_______________________________________________ Tiff mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/tiff
