A request for help: TIFF writing

I recently discovered that TIFF writing in Filmulator has stopped working as expected, despite the TIFF writing code not having changed since before there was any GUI at all.

When I open a Filmulator-output TIFF in GIMP, it apparently has four pages to the TIFF, and only the first one has the image data, the other three don’t work.

When running tiffinfo on the file, it gives the following:

TIFF Directory at offset 0x8 (8)
  Image Width: 2920 Image Length: 4100
  Bits/Sample: 16
  Compression Scheme: None
  Photometric Interpretation: RGB color
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 3
  Planar Configuration: single image plane
  Make: Canon
  Model: Canon EOS 5D
  DateTime: 2017:08:01 16:12:15
  EXIFIFDOffset: 0xe4
TIFFFetchNormalTag: Warning, Incorrect count for "MakerNote"; tag ignored.
TIFFReadCustomDirectory: Warning, Wrong data type 3 for "PixelXDimension"; tag ignored.
TIFFReadCustomDirectory: Warning, Wrong data type 3 for "PixelYDimension"; tag ignored.
TIFFReadCustomDirectory: Warning, Unknown field with tag 40965 (0xa005) encountered.
TIFF Directory at offset 0xe4 (228)
  ExposureTime: 0.000625
  FNumber: 0.000000
  ExposureProgram: 3
  ISOSpeedRatings: 100
  ExifVersion: 0x30,0x32,0x32,0x31
  DateTimeOriginal: 2017:08:01 16:12:15
  DateTimeDigitized: 2017:08:01 16:12:15
  ComponentsConfiguration: 0x1,0x2,0x3,0x0
  ShutterSpeedValue: 10.625000
  ApertureValue: 2147483648.000000
  ExposureBiasValue: 0.000000
  MeteringMode: 0
  Flash: 16
  FocalLength: 0.000000
  UserComment: 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  FlashpixVersion: 0x30,0x31,0x30,0x30
  ColorSpace: 1
  Tag 40965: 75992
  FocalPlaneXResolution: 3086.925781
  FocalPlaneYResolution: 3091.295166
  FocalPlaneResolutionUnit: 2
  CustomRendered: 0
  ExposureMode: 0
  WhiteBalance: 1
  SceneCaptureType: 0
TIFFReadDirectory: Warning, Unknown field with tag 513 (0x201) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 514 (0x202) encountered.
MissingRequired: TIFF directory is missing required "ImageLength" field.

Nowhere does it seem to show that there are any extra frames or anything…

Anyone have any idea why this might be? Filmulator’s TIFF writing code is in this file.

If we can’t figure this out we may try switching to another TIFF library, like maybe TinyTIFF…

Are you sure the bug is in Filmulator and not in Gimp?

You might be right.

The TIFF works fine in RawTherapee…

Before you indict libtiff, you might comment out the exiv2 code at the bottom of the routine, recompile, and generate a new test image. I don’t see anything out of order with your libtiff code.


That worked. I suppose that our current strategy of copying all the exif over wholesale is what’s causing issues.

I’ve gone back and forth about the whole exif enchilada, but I’ve found I really only need the essential exposure/focal length information carried forward. If I want to pick at the image exif-wise, I just open the raw; I put in a exiftool-based dialog box for that purpose.

Edit: Oh, TIFFs vex that approach; the libtiff-supported metadata is not camera-oriented.

I guess your problem is coming from the thumbnail(s) in the RAW file. I had to deal with the same problem in photoflow, and came up with a pretty simple solution with EXIV2. You can check the lines of code starting from here.

Hope this helps!


Interestingly, it didn’t help. I guess I’ll have to list all the tags and see which ones cause problems…

You might want to look at https://github.com/darktable-org/darktable/blob/master/src/common/exif.cc and grep for dt_remove_exif_keys in there. We have a few places with lists of EXIF tags that may not be written to the exported images.

1 Like