2004.06.29 04:44 "[Tiff] Saving Exif with TiffLib", by Alex Kon

2004.06.29 15:30 "Re: [Tiff] Saving Exif with TiffLib", by Antonio Scuri

Unfortunately the Exif specification defines the Exif Tag as an Offset to a private IFD. It is not a complete IFD, just some simple tags with camera and user information.

I've got a sample from a Sony Mavica. I put it on the url:

http://www.tecgraf.puc-rio.br/~scuri/exif_test.tif (9Mb)

Sorry about the file size, but even changing the configuration in the camera the image saved is 2048x1536. Also the TIFF generated by the Sony is not compressed, and I would like to preserve the original file.

Some time ago I sent a message to the list about Exif data.

My idea was to use TIFFSetSubDirectory to access the Exif subdiretory, but since it has no image, TIFFReadDirectory fail to load.

I also registered the Exif tags using TIFFSetTagExtender, just like the GeoTIFF tags.

The code looks like:

   short tag_count;
   void* data;
   if (TIFFGetField(tiff, TIFFTAG_EXIFIFDPOINTER, &tag_count, &data))
   {
     uint32 offset = *(uint32*)data;                       // I checked the returned offset and it is correct
     if (!TIFFSetSubDirectory(tiff, offset))             // I debug the code and returns when it does not find the image size, tif_dirread.c line 374
       return;

     // Use TIFFGetField to get the tags
     // Reset the sub directory using TIFFSetSubDirectory
   }

Or we could have a function just to load the tags in that IFD with interfering in the TIFFSetSubDirectory/TIFFReadDirectory logic.

Best,
scuri