Bug 446403

Summary: Metadata not read correctly (XMP instead of EXIF)
Product: [Applications] digikam Reporter: MarcP <iwannaberich>
Component: Metadata-ExifAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, iwannaberich
Priority: NOR    
Version: 7.4.0   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed In: 7.4.0
Sentry Crash Report:
Attachments: Digikam's Metadata panel (EXIF) for affected picture.
Digikam's Metadata panel (XMP) for affected picture.

Description MarcP 2021-12-03 04:46:30 UTC
SUMMARY
I noticed that in some random pictures I took last week, digikam was not able to read the metadata. Information such as the date and the picture orientation was not read from the picture metadata. When looking at the metadata panels, I see that all the metadata is seen in the XMP section instead of the EXIF (which appears as blank), but when inspecting the metadata using another tool (e.g. Jeffrey's Image metadata viewer http://exif.regex.info/) I can see that there is indeed EXIF info in the picture. Strangely enough, other pictures from the same batch had their metadata read correctly.

I have attached one of the affected pictures as a reference. It has not been edited in any way, just straight out of the camera. Also a capture of the EXIF data in the mentioned website, and a couple captures of the metadata section in Digikam.

However, I tried with Digikam 7.3 (stable, appimage) and all the metadata was read correctly, so this problem seems to be specific to v7.4

STEPS TO REPRODUCE
1. Transfer pictures from camera to folder in PC.
2. Start digikam and wait until finishes exploring new elements.


OBSERVED RESULT
Notice how some elements do not include the date or the picture orientation.

EXPECTED RESULT
Exif metadata should be read correctly.

SOFTWARE/OS VERSIONS
Digikam 7.4.0 Build date: 2/12/21 10:27 (target: Debug)
Rev.: 7ac1b183b14ecd37e72f181e1702ddee1b2a22b7
Ubuntu 20.04.3 LTS
Comment 1 MarcP 2021-12-03 04:50:06 UTC
Created attachment 144161 [details]
Digikam's Metadata panel (EXIF) for affected picture.
Comment 2 MarcP 2021-12-03 04:50:55 UTC
Created attachment 144162 [details]
Digikam's Metadata panel (XMP) for affected picture.
Comment 3 MarcP 2021-12-03 04:56:18 UTC
I could not upload an affected picture due to the file size. Here's a link to the affected picture (compressed in ZIP to preserve format): https://easyupload.io/efm7gq
Comment 4 MarcP 2021-12-03 04:58:15 UTC
Outcome of Jeffrey Friedl's Image Metadata Viewer for the affected picture. (Link expires in 30 days):
https://easyupload.io/a9oqqn
Comment 5 caulier.gilles 2021-12-03 05:10:55 UTC
Hi,

I tried under Mac and digiKam 7.4.0, compiled with Exiv2 0.27.5 and XMP support.

The problem is clear on the command line traces. It come from Exiv2 shared library : 

digikam.metaengine: Cannot load metadata from file with Exiv2 backend: /System/Volumes/Data/Users/gilles/Pictures/DSC06971.JPG  (Error # 59 :  "corrupted image metadata".

So, i recommend to tried to read metadata ith Exiv2 CLI tool with this image. Typically, it must report the same problem. If yes, make a new bug entry in Exiv2 project from github with a link to the image for future investigations by Exiv2 team.

Best

Gilles Caulier
Comment 6 MarcP 2021-12-03 05:17:43 UTC
In my setup, I have exiv2 0.27.2. It seems to read the metadata correctly:

(base) marc@marc-TM1703:~$ exiv2 --version
exiv2 0.27.2

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
(base) marc@marc-TM1703:~$ exiv2 -p a DSC07110.JPG 
Exif.Image.ImageDescription                  Ascii      32                                 
Exif.Image.Make                              Ascii       5  SONY
Exif.Image.Model                             Ascii      10  ILCE-5000
Exif.Image.Orientation                       Short       1  left, bottom
Exif.Image.XResolution                       Rational    1  350
Exif.Image.YResolution                       Rational    1  350
Exif.Image.ResolutionUnit                    Short       1  inch
Exif.Image.Software                          Ascii      16  ILCE-5000 v1.10
Exif.Image.DateTime                          Ascii      20  2021:11:27 12:51:55
Exif.Image.YCbCrPositioning                  Short       1  Co-sited
Exif.Image.ExifTag                           Long        1  364
Exif.Photo.ExposureTime                      Rational    1  1/80 s
Exif.Photo.FNumber                           Rational    1  F11
Exif.Photo.ExposureProgram                   Short       1  Auto
Exif.Photo.ISOSpeedRatings                   Short       1  100
Exif.Photo.SensitivityType                   Short       1  2
Exif.Photo.RecommendedExposureIndex          Long        1  100
Exif.Photo.ExifVersion                       Undefined   4  2.30
Exif.Photo.DateTimeOriginal                  Ascii      20  2021:11:27 12:51:55
Exif.Photo.DateTimeDigitized                 Ascii      20  2021:11:27 12:51:55
Exif.Photo.ComponentsConfiguration           Undefined   4  YCbCr
Exif.Photo.CompressedBitsPerPixel            Rational    1  3
Exif.Photo.BrightnessValue                   SRational   1  8.91172
Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
Exif.Photo.MaxApertureValue                  Rational    1  F3.5
Exif.Photo.MeteringMode                      Short       1  Multi-segment
Exif.Photo.LightSource                       Short       1  Unknown
Exif.Photo.Flash                             Short       1  No, compulsory
Exif.Photo.FocalLength                       Rational    1  16.0 mm
Exif.Photo.MakerNote                         Undefined 37103  (Binary value suppressed)
Exif.MakerNote.Offset                        Long        1  922
Exif.MakerNote.ByteOrder                     Ascii       3  II
Exif.Sony1.Panorama                          Long       16  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Exif.Sony1.PreviewImage                      Undefined 1077203  (Binary value suppressed)
Exif.Sony1.Contrast                          SLong       1  0
Exif.Sony1.Saturation                        SLong       1  0
Exif.Sony1.AutoHDR                           Long        1  Off
Exif.Sony1.ShotInfo                          Undefined 390  (Binary value suppressed)
Exif.Sony1.ColorReproduction                 Ascii      16  Standard
Exif.Sony1.ColorTemperature                  Long        1  0
Exif.Sony1.ColorCompensationFilter           Long        1  0
Exif.Sony1.SceneMode                         Long        1  Auto
Exif.Sony1.ZoneMatching                      Long        1  ISO Setting Used
Exif.Sony1.DynamicRangeOptimizer             Long        1  Auto
Exif.Sony1.ImageStabilization                Long        1  On
Exif.Sony1.ColorMode                         Long        1  Standard
Exif.Sony1.FullImageSize                     Long        2  3632 x 5456
Exif.Sony1.PreviewImageSize                  Long        2  1080 x 1616
Exif.Sony1.FileFormat                        Byte        4  ARW 2.3.1
Exif.Sony1.Quality                           Long        1  Fine
Exif.Sony1.FlashExposureComp                 SRational   1  0 EV
Exif.Sony1.WhiteBalanceFineTune              Long        1  0
Exif.Sony1.WhiteBalance                      Long        1  Auto
Exif.Sony1.SonyModelID                       Short       1  ILCE-5000
Exif.Sony1.Teleconverter                     Long        1  None
Exif.Sony1.LensID                            Long        1  Manual lens
Exif.Sony1.ExposureMode                      Short       1  Program
Exif.Sony1.JPEGQuality                       Short       1  n/a
Exif.Sony1.FlashLevel                        SShort      1  Normal
Exif.Sony1.ReleaseMode                       Short       1  Normal
Exif.Sony1.SequenceNumber                    Short       1  Single
Exif.Sony1.AntiBlur                          Short       1  On (Shooting)
Exif.Sony1.DynamicRangeOptimizer             Short       1  Standard
Exif.Sony1.IntelligentAuto                   Short       1  On
Exif.Sony1.WhiteBalance2                     Short       1  Auto
Exif.Photo.UserComment                       Undefined  64  
Exif.Photo.FlashpixVersion                   Undefined   4  1.00
Exif.Photo.ColorSpace                        Short       1  sRGB
Exif.Photo.PixelXDimension                   Long        1  5456
Exif.Photo.PixelYDimension                   Long        1  3632
Exif.Photo.InteroperabilityTag               Long        1  38156
Exif.Iop.InteroperabilityIndex               Ascii       4  R98
Exif.Iop.InteroperabilityVersion             Undefined   4  1.00
Exif.Photo.FileSource                        Undefined   1  Digital still camera
Exif.Photo.SceneType                         Undefined   1  Directly photographed
Exif.Photo.CustomRendered                    Short       1  Normal process
Exif.Photo.ExposureMode                      Short       1  Auto
Exif.Photo.WhiteBalance                      Short       1  Auto
Exif.Photo.DigitalZoomRatio                  Rational    1  1.0
Exif.Photo.FocalLengthIn35mmFilm             Short       1  24.0 mm
Exif.Photo.SceneCaptureType                  Short       1  Standard
Exif.Photo.Contrast                          Short       1  Normal
Exif.Photo.Saturation                        Short       1  Normal
Exif.Photo.Sharpness                         Short       1  Normal
Exif.Photo.LensSpecification                 Rational    4  160/10 500/10 35/10 56/10
Exif.Photo.LensModel                         Ascii      26  E PZ 16-50mm F3.5-5.6 OSS
Exif.Image.PrintImageMatching                Undefined 106  80 114 105 110 116 73 77 0 48 51 48 48 0 0 3 0 2 0 1 0 0 0 3 0 34 0 0 0 1 1 0 0 0 0 9 17 0 0 16 39 0 0 11 15 0 0 16 39 0 0 151 5 0 0 16 39 0 0 176 8 0 0 16 39 0 0 1 28 0 0 16 39 0 0 94 2 0 0 16 39 0 0 139 0 0 0 16 39 0 0 203 3 0 0 16 39 0 0 229 27 0 0 16 39 0 0
Exif.Thumbnail.Compression                   Short       1  JPEG (old-style)
Exif.Thumbnail.ImageDescription              Ascii      32                                 
Exif.Thumbnail.Make                          Ascii       5  SONY
Exif.Thumbnail.Model                         Ascii      10  ILCE-5000
Exif.Thumbnail.Orientation                   Short       1  left, bottom
Exif.Thumbnail.XResolution                   Rational    1  72
Exif.Thumbnail.YResolution                   Rational    1  72
Exif.Thumbnail.ResolutionUnit                Short       1  inch
Exif.Thumbnail.Software                      Ascii      16  ILCE-5000 v1.10
Exif.Thumbnail.DateTime                      Ascii      20  2021:11:27 12:51:55
Exif.Thumbnail.JPEGInterchangeFormat         Long        1  38448
Exif.Thumbnail.JPEGInterchangeFormatLength   Long        1  11084
Exif.Thumbnail.YCbCrPositioning              Short       1  Co-sited
(base) marc@marc-TM1703:~$ 


I will try to compile 0.27.5 and report back.
Comment 7 MarcP 2021-12-03 05:22:14 UTC
You are right, it fails in exiv 0.27.5:

(base) marc@marc-TM1703:~/Baixades/exiv2-0.27.5-Linux64$ bin/exiv2 -p a ~/DSC07110.JPG 
Exiv2 exception in print action for file /home/marc/DSC07110.JPG:
corrupted image metadata


I have checked exiv2's project on github, and it's probably related to this bug: https://github.com/Exiv2/exiv2/issues/2001
Comment 8 MarcP 2021-12-08 17:21:22 UTC
That bug has already been fixed. I tried the last nightly release and I can confirm that exiv2 once again can read the metadata for these pictures taken with a Sony camera. I don't know when a stable build will be published.
Comment 9 caulier.gilles 2021-12-08 18:19:04 UTC
Hi Marc,

2 possibilities : 

- code from digiKam core fixed recently.
- code from Exiv2 fixed recently.

Both in AppImage bundle use a rolling release code (digiKam from git/master, and Exiv2 from 0.27-maintenance branch).

Best

Gilles Caulier
Comment 10 MarcP 2021-12-08 20:33:29 UTC
Oh, ok, I didn't know digikam used rolling release code from exiv2. I have only tried it directly on exiv2, but in that case I guess that it also has been fixed in Digikam.