2015.02.16 18:32 "[Tiff] custom tags between 3.9 and 4.0", by David Hoese


I'm debugging some code that used to use libtiff 3.9.4, but now doesn't work with libtiff 4.0.3. A while ago I added the ability to add custom tags to the pylibtiff package specifically the libtiff_ctypes.py module (https://code.google.com/p/pylibtiff/). This uses the 3.9 method of TIFFMergeFieldInfo which doesn't seem recommended/supported anymore after looking at the 4.0 source in tif_dirinfo.c.

The problem I'm running in to is after creating a custom tag with readcount=1 and passcount=0 and type "TIFF_SLONG", the type assigned by "_TIFFSetGetFieldtype" is "TIFF_SETGET_SINT32". When reading a file with this custom tag I get the "Assertion failed: (0), function TIFFFetchNormalTag, file tif_dirread.c, line 5353." error and then the program aborts. It looks like this happens because "TIFF_SETGET_SINT32" isn't actually handled by "TIFFFetchNormalTag" (along with a lot of other types).

Can anyone suggest a path for me to fix this? It looks like "_TIFFCreateAnonField" or "_TIFFSetupFields" are the only ways to create custom fields. Is there any updated documentation for adding custom tags that someone could point me to?

Thanks for any help. Please CC me in any replies.