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

2004.06.29 17:01 "[Tiff] Saving Exif with TiffLib", by Jim Schueckler

My task is to save Exif-data into tiff-images. According to Exif specification I should put Exif-specific data into subIFDs, that are not linked into common directories chain. And, as far as I understand, there is no regular mechanism to create such IFDs, because SUBIFD tag, specified by TiffLib has its own hardcoded value, while Exif-tags with offsets to corresponding Exif-SubIFDs should have other values, that are defined by Exif-standart. Should I modify TIffLib (add Exif-tags and made some extension of SubIFD-mechanism) to solve my problems, or there is any other way?

I've read the previous posts on this thread but did not include them to save bandwidth. My answer is directed to a possible format for the output file, and does not directly address using tifflib. We use our own code to do what tifflib does. Sorta'

I recently had to implement putting EXIF data into TIFF files exported by the Kodak Professional DCS Photo Desk application. (Free at www.Kodak.com, search for "Photo Desk")

Since the EXIF spec is really intended for camera-generated JPEG files, the spec does not strictly apply and can't be implemented for TIFF's exactly the same way. Therefore our main goal was to be as compatible as possible with other applications and to carry all the EXIF data so a TIFF file exported by Photo Desk could be re-opened by Photo Desk and then exported as a JPEG-EXIF file without losing any information.

During development, I used several versions of Adobe Photoshop, Photo Studio ( free at http://www.stuffware.co.uk/photostudio ), and Apple's iPhoto to test that those apps could read the EXIF data.

Your mileage may vary, but what I found to be most compatible is below. Note we only have one main image and its thumbnail, so this may not work exactly the same if the TIFF file has multiple images.

If anybody would like me to send them an example TIFF file, (I can make a small image) ask me at James.Schueckler@Kodak.com

  1. IFD0 contains the tag ExifIFD ( decimal 34665, hex 0x8769 ) that has the offset of the Exif IFD.
  2. The EXIF IFD does not contain imageLength and imageWidth, etc. It just contains "camera data", which can include:

   ExposureTime, // 0x829A 33434
   FNumber, // 0x829D 33437
   ExposureProgram, // 0x8822 34850
   ISOSpeedRatings, // 0x8827 34855
   ExifVersion, // 0x9000 36864
   DateTimeOriginal, // 0x9003 36867
   DateTimeDigitized, // 0x9004 36868
   ComponentsConfiguration, // 0x9101 37121
   CompressedBitsPerPixel, // 0x9102 37122
   ShutterSpeedValue, // 0x9201 37377
   ApertureValue, // 0x9202 37378
   BrightnessValue, // 0x9203 37379
   ExposureBiasValue, // 0x9204 37380
   MaxApertureValue, // 0x9205 37381
   MeteringMode, // 0x9207 37383
   LightSource, // 0x9208 37384
   FlashTiffTag, // 0x9209 37385
   FocalLength, // 0x920A 37386
// MakerNote, // 0x927C 37500 MakerNote CAUSES CRASHES
// see http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html
// My code does not copy MakerNote because there are different
// interpretations of the "spec", some of which can cause a crash
// if interpreted incorrectly.
   UserComment, // 0x9286 37510
   FlashPixVersion, // 0xA000 40960
   ColorSpace, // 0xA001 40961
   FocalPlaneXResolutionExif, // 0xA20E 41486
   FocalPlaneYResolutionExif, // 0xA20F 41487
   FocalPlaneResolutionUnitExif,// 0xA210 41488
   ExposureIndexExif, // 0xA215 41493
   SensingMethodExif, // 0xA217 41495
   FileSource, // 0xA300 41728
   SceneType, // 0xA301 41729
   CustomRendered, // 0xA401 41985
   ExposureMode, // 0xA402 41986
   WhiteBalanceExif, // 0xA403 41987
   DigitalZoomRatio, // 0xA404 41988
   FocalLengthIn35mmFilm, // 0xA405 41989
   SceneCaptureType, // 0xA406 41990
   GainControl, // 0xA407 41991
   Contrast, // 0xA408 41992
   Saturation, // 0xA409 41993
   Sharpness, // 0xA40A 41994
   SubjectDistanceRange, // 0xA40C 41996
   GammaExif // 0xA500 42240

Jim Schueckler  (585)726-6369       Professional Digital Cameras 1/205/KP
kmx-236-6369 fax(585)726-6669       Eastman Kodak Company MS 03010
mailto:James.Schueckler@kodak.com   2400 Mt Read Boulevard
http://www.kodak.com/go/kpdp        Rochester NY 14650-3010
"Oh! I have slipped the surly bonds of earth..." J.G. McGee