Bug 515664 - Wrong Exif orientation in stored image files when auto rotating
Summary: Wrong Exif orientation in stored image files when auto rotating
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Orientation (other bugs)
Version First Reported In: 8.8.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-06 23:56 UTC by Markus S.
Modified: 2026-02-08 21:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus S. 2026-02-06 23:56:45 UTC
This bug happens when auto rotating images according to their exif rotation while using xmp-sidecars. It's triggered by importing images from camera/storage or using Item/Rotate/Auto rotate.

Step to reproduce
1.) Configure Digikam as follows
  Metadata/Sidecars/Reading and Writing to Sidecars
    [x] Read from sidecar files
    [x] Write to sidecar files
       => Write to XMP sidecar only
  Metadata/Behavior/Reading and Writing Metadata
    [x] Use lazy synchronization
    [x] update filemod. timestamp ...
    [x] Rescan file...

2.) Import an image with exif orientation = 6 (CW)  
  (6 is just an example, the bug generally happens with orientations != 1)

- Image data is rotated according original exif rotation and image file is saved 
- Exif data of saved image file still contains old - now invalid - orientation
  => Data inside the image is rotated to 1 (Normal)
  => New image is saved still with Exif orientation 6 (CW) 
- (only) the corresponding xmp File contains the now correct exif rotation value 1 = normal
  
  result:
- Digikam still displays the image in correct orientation, either due to caching or only evaluating only the xmp file  - to make digikam display the image in the now wrong orientation, the .xmp has to be deleted and then the metadata must be re-read from the image
- other image viewers which ignore the xmp file show the image rotated once more => that's odd.
  
As a workaround, the wrong metadata can be easily fixed using
  exiftool -P  -n -Orientation=1  -overwrite_original  FILENAME.JPG

Version Info:
digiKam: 8.8.0
KDE Frameworks: 6.22.0
Qt: Using 6.10.1 and built against 6.10.1
openSUSE Tumbleweed (Xcb)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.17.9-1-default
Comment 1 Maik Qualmann 2026-02-08 08:10:14 UTC
This isn't a bug if you enable "write only in sidecar" in that case. The original image won't be changed, nor will the orientation flag.

Some users enable "write only in sidecar" to avoid changing the original image. We can't simply make an exception for the orientation flag here.

Maik
Comment 2 Maik Qualmann 2026-02-08 15:12:02 UTC
My comment wasn't entirely accurate. When we rotate an image, we also write the orientation flag, provided the option is enabled.

I can't reproduce the problem with the auto-rotation function here; the orientation flag is correctly set to "Normal."

Please provide a sample image where the problem occurs.

Maik
Comment 3 Markus S. 2026-02-08 21:05:31 UTC
Maik, since sample images are large I just sent you a PM containg a link for downloading a sample image. You'll find two folders: 

a) after-digikam-import-with-autorotate 
  also containing the digikam generated .xmp. 

b) original-from-camera
The second is just copied outside digikam.