Bug 338075 - Tagging RAW images for Canon EOS-1Ds with Exiv2 corrupts them - Use ExifTool instead
Summary: Tagging RAW images for Canon EOS-1Ds with Exiv2 corrupts them - Use ExifTool ...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-ExifTool (show other bugs)
Version: 4.2.0
Platform: Mint (Ubuntu based) Linux
: NOR grave
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-06 18:32 UTC by kaptainkory
Modified: 2022-04-08 03:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 8.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kaptainkory 2014-08-06 18:32:01 UTC
I have digital RAW images taken with a Canon EOS-1Ds (mark 1, original).  Tagging these images in digiKam corrupts them.

For some bizarre reason, Canon gave these raw images a .TIF extension which has causes all kinds of issues along the way!  In digiKam, it appears that the embedded thumbnails are rendered correctly (though small) in Thumbnails and Preview Image views.  However, opening these files for editing only treats them as true TIF files, opening only the embedded thumbnail.

After renaming with a .RAW extension (usually a fix for these things), digiKam displays a thumbnail with strange colors in Thumbnails and Preview Image views, but it does open correctly for editing.

I can live with the thumbnail quirks, but I can't live with completely corrupted files just by tagged them!!!  Tagging images should be a very safe thing to do, but right now someone is in danger of losing their entire library of these files!!!  Thank goodness I had backups and caught what was happening.

When these files have a .TIF extension, tagging always corrupts them.  When these files have a .RAW extension and "If possible write Metadata to RAW files (experimental)" in the settings is unchecked, sidecar XMP files are created and the originals spared.

When corruption occurs, what should be 9-11 MB files are resaved as 280ish KB files (embedded thumbnail?).  No warnings or any other obvious signs hint that this has occurred.

A sample raw image for testing can be downloaded:

https://drive.google.com/file/d/0ByXO8US0zFPicXFYVV9ISDY0Rlk/edit?usp=sharing
Comment 1 caulier.gilles 2014-08-06 19:42:37 UTC
Tags are writtent to image through Exiv2 library.

Please report this problem to Exiv2 bugzilla...

http://dev.exiv2.org/projects/exiv2/issues

Thanks in advance

Gilles Caulier
Comment 2 kaptainkory 2014-08-06 21:18:08 UTC
OK, thanks.  Reported here:

http://dev.exiv2.org/issues/977
Comment 3 caulier.gilles 2021-04-25 10:17:07 UTC

*** This bug has been marked as a duplicate of bug 326408 ***
Comment 4 caulier.gilles 2022-04-07 04:59:13 UTC
Git commit 3a672f38cda7738356f19707a6a634ca91c269e6 by Gilles Caulier.
Committed on 07/04/2022 at 04:45.
Pushed by cgilles into branch 'master'.

Write metadata with ExifTool backend if Exiv2 fails to process, for exemple with RAW files or Video files.
Tested successfuly with a MP4 video to insert a comment.
For RAW and other king of files as MPO or JPEG with more than 64kB of Exif segement, Exiv2 must be bannned to uses in cases of writting operations as files can be corrupted.
This require more regression tests to validate ExifTool uses in place of Exiv2.
Related: bug 406540, bug 416516, bug 237504, bug 384092, bug 264210, bug 326408, bug 421464, bug 134486, bug 309341, bug 219856, bug 377622, bug 325458, bug 170693, bug 448729, bug 436876, bug 366348

M  +1    -0    core/libs/metadataengine/dmetadata/dmetadata.h
M  +43   -0    core/libs/metadataengine/dmetadata/dmetadata_exiftool.cpp
M  +49   -3    core/libs/metadataengine/dmetadata/dmetadata_fileio.cpp
M  +2    -2    core/libs/metadataengine/exiftool/exiftoolparser.h

https://invent.kde.org/graphics/digikam/commit/3a672f38cda7738356f19707a6a634ca91c269e6
Comment 5 caulier.gilles 2022-04-08 03:37:38 UTC
Git commit 80ecdd9980c6cf14789606455bf9d367c1ffef51 by Gilles Caulier.
Committed on 08/04/2022 at 03:25.
Pushed by cgilles into branch 'master'.

Use only ExifTool backend to write metadata to RAW files, as Exiv2 is fully unsafe with these kind of operations.
Reading and Writing metadata to video files is now delegate to ExifTool Backend too.
Related: bug 406540, bug 416516, bug 237504, bug 384092, bug 264210, bug 326408, bug 134486, bug 309341, bug 377622, bug 170693, bug 419801, bug 366348
FIXED-IN: 8.0.0

M  +1    -0    NEWS
M  +13   -0    core/libs/metadataengine/dmetadata/dmetadata_exiftool.cpp
M  +6    -52   core/libs/metadataengine/engine/metaengine_p.cpp
M  +4    -20   core/utilities/setup/metadata/setupmetadata.cpp
M  +3    -4    core/utilities/setup/metadata/setupmetadata_behavior.cpp

https://invent.kde.org/graphics/digikam/commit/80ecdd9980c6cf14789606455bf9d367c1ffef51