Bug 211066 - TIFFs written by digiKam not readable with GIMP
Summary: TIFFs written by digiKam not readable with GIMP
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-DImg-TIFF (show other bugs)
Version: 1.0.0
Platform: Ubuntu Unspecified
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-19 12:48 UTC by Leonardo Giordani
Modified: 2018-09-02 15:33 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.0


Attachments
Small example, tiff file written and then metadata written with exiv2 SVN (1912) (299.66 KB, image/tiff)
2009-11-06 16:16 UTC, Marcel Wiesweg
Details
Other cloud, this time written as usual but metadata not written with libexiv2 (409.03 KB, image/tiff)
2009-11-06 16:17 UTC, Marcel Wiesweg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leonardo Giordani 2009-10-19 12:48:56 UTC
Version:           1.0.0-beta6 rev 1032708 (using KDE 4.3.2)
Installed from:    Ubuntu Packages

When saving a TIFF with digiKam, it cannot be opened with GIMP 2.6.6, causing the following two errors

* invalid TIFF directory; tags are not sorted in ascending order
* TIFF directory is missing required "ImageLength" field

-------

Digikam info:

digiKam version 1.0.0-beta6 (rev.: 1032708)
Exiv2 can write to Jp2: Yes
Exiv2 can write to Jpeg: Yes
Exiv2 can write to Pgf: No
Exiv2 can write to Png: Yes
Exiv2 can write to Tiff: Yes
Exiv2 supports XMP metadata: Yes
LibCImg: 130
LibExiv2: 0.18
LibJPEG: 62
LibJasper: 1.900.1
LibKDE: 4.3.2 (KDE 4.3.2)
LibKExiv2: 0.6.0
LibKdcraw: 1.0.0
LibLCMS: 118
LibPGF: 6.09.33
LibPNG: 1.2.27
LibQt: 4.5.2
LibRaw: 0.8.2
LibTIFF: LIBTIFF, Version 3.8.2 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.
Marble widget: 0.8.1
Parallelized demosaicing: No
LibGphoto2: 2.4.2
LibKipi: 1.0.0
Comment 1 caulier.gilles 2009-10-19 13:00:30 UTC
Leonardo,

I recommend to update Exiv2 to 0.18.2. This require to recompile libkexiv2 + digiKam & co.

Andreas, 

I suspect a problem with Exiv2 there. To generate a TIFF file, digiKam use std libtiff, and after call Exiv2 to write some IPTC and XMP to image.

http://lxr.kde.org/source/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp#829

Gilles
Comment 2 Andreas Huggel 2009-10-19 19:39:02 UTC
Leonardo,

Can you please provide a sample picture so that we can see which tags are not sorted as they should be?

As for the missing ImageLength tag (probably Exif.Image.ImageLength), digiKam will need to make sure it's there. Exiv2 doesn't care.

Andreas
Comment 3 Leonardo Giordani 2009-10-20 15:37:15 UTC
I upladed to Megaupload http://www.megaupload.com/?d=I2TEKZHR a sample image which exposes the problem.
Comment 4 Marcel Wiesweg 2009-11-06 16:16:19 UTC
Created attachment 38137 [details]
Small example, tiff file written and then metadata written with exiv2 SVN (1912)
Comment 5 Marcel Wiesweg 2009-11-06 16:17:52 UTC
Created attachment 38138 [details]
Other cloud, this time written as usual but metadata not written with libexiv2
Comment 6 Marcel Wiesweg 2009-11-06 16:23:21 UTC
I can reproduce this problem. Writing any TIFF file will create a file that can be opened, but GIMP complains:

unknown field with tag 11 (0xb) encountered
unknown field with tag 18246 (0x4746) encountered
unknown field with tag 18249 (0x4749) encountered
unknown field with tag 513 (0x201) encountered
unknown field with tag 514 (0x202) encountered

and shows the error messages mentioned previously.

Removing the single line that calls libexiv2 to write metadata to the newly written TIFF file cures the problem (see second sample image).

Note that the second image has some metadata as well because digikam already writes Xmp, Iptc and some Exif tags using libtiff directly (probably coming from times when exiv2 couldn't do that)
Comment 7 caulier.gilles 2009-11-06 19:22:29 UTC
Yes, i can reproduce it also.

So the problem is in Exiv2... certainly...

Andreas ?

Gilles
Comment 8 Andreas Huggel 2009-11-08 16:10:51 UTC
Looks like Exif data from a JPEG image in a TIFF file. E.g., it has thumbnail tags, which are common in JPEG, but here they turn this image into a multi-page TIFF image (and apparently an invalid one due to the JPEG thumbnail) - probably not what was intended.

This is a combination of bug #183171 and the issue discussed here http://dev.exiv2.org/boards/3/topics/show/20, I guess.

Exiv2 is not user-friendly when writing to TIFF. Currently, an application must make sure it writes only valid tags to TIFF images and preserves tags which are needed for the image itself. But if it does that, it will work. See the exiv2 command-line tool for an example, a pointer is in the thread mentioned above.

Andreas
Comment 9 Andreas Huggel 2009-11-08 16:13:23 UTC
Sorry, there is a typo in the link above. The correct URL is: http://dev.exiv2.org/boards/3/topics/show/201

Andreas
Comment 10 Marcel Wiesweg 2009-12-06 17:23:27 UTC
Bugs 217593, 212072, 211066 and 211758 are now all merged to bug #211758

*** This bug has been marked as a duplicate of bug 211758 ***
Comment 11 caulier.gilles 2018-09-02 15:29:34 UTC
Not reproducible in 6.0.0