You need to log in before you can comment on or make changes to this bug.
I'm not really sure if it's some kind of a bug, and excuse me for my bad bug reporting skills - this is my first - but when trying to read the exif version from the exif IFD in a tif file using: TIFFGetField(tif, EXIFTAG_EXIFVERSION, &exifVersion) I can't seem to get the correct version number, which should be 0230 in the files I'm testing. Using the exiftool by Phil Harvey (Great Job btw!) I'm getting the correct number, however when using libtiff in my C++ code, it's not working. Other tags can be read correctly without any trouble, but I suspect the problem to be in TIFF_SETGET_C0_UINT8, which decides what type the tag is. -------------------------------------------------------------------------------- To re-produce what happens in my code: 1) Open a .tif file (with EXIF information) for reading I'll call the file tif. 2) Open the exif IFD using TIFFGetField(tif, TIFFTAG_EXIFIFD, &exifOffset) exifOffset is an integer type 3) Read the exif directory using TIFFReadEXIFDirectory(tif, exifOffset) 4) Read the exif version using TIFFGetField(tif, EXIFTAG_EXIFVERSION, &exifVersion) exifVersion is a pointer to an array of type uint8 and length 4, as defined in the TIFF and EXIF documentation. 5) Use a debugger t directly look at the values stored in exifVersion, or read it again using any preferable method to find that the exif version was not read correctly. -------------------------------------------------------------------------------- I've tried all possible variations of arrays, pointers, references, different sizes, dynamic, static allocation, with and without passing a count variable in the method e.g. TIFFGetField(tif, EXIFTAG_EXIFVERSION, &count, &exifVersion) but nothing seems to work the way it should. So I debugged it and found this in the libtiff code: In file tif_dir.c: method TIFFVGetField(TIFF* tif, uint32 tag, va_list ap) lines 1065 to 1080 I can't find the place where the actual values are copied. It seems that the routine just returns something, but not what is in the file! I can't even tell if this routine tries to detirmine the type of the tag?! I hope it's not a bug, but that I just simply missed something! Thanks and cheers Nouri
Not a bug! One has to copy the values stored at the address of the passed pointer to a local variable before closing the tiff file or changing the open directory etc. otherwise the values will be lost, as they are dynamically allocated by libtiff for reading, and deleted / rewritten after completion.