Bug 400492 - Rotation does not work
Summary: Rotation does not work
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Orientation (show other bugs)
Version: 6.0.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-30 19:28 UTC by Milan Knížek
Modified: 2018-11-03 13:10 UTC (History)
2 users (show)

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


Attachments
Sample files (The file names are self-explanatory) (897.71 KB, application/zip)
2018-10-30 19:28 UTC, Milan Knížek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Knížek 2018-10-30 19:28:37 UTC
Created attachment 115991 [details]
Sample files (The file names are self-explanatory)

SUMMARY

Rotation functionality does not seem to work properly.

Use the attached images for testing.

In Settings // Configure digiKam // Metadata // Rotation set "write normal flag orientation after rotate". Other settings as per attached screenshot.

STEPS TO REPRODUCE
Try to manually rotate left or right, autorotate, set orientation flag.

OBSERVED RESULT
The image either does not rotate at all or rotate somewhat unexpectedly.

The orientation flag as per Item // Adjust Exif Orientation Tag remains as "rotated right", although exiv2 confirms that after rotation, the flags are "top, left".

Rebuilding thumbnail (Tools // Maintenance) does not change this behaviour.

On some images, the thumbnail orientation flag may become inconsistent with other orientation flags.

EXPECTED RESULT
The image visually rotates as per instruction, the thumbnail is rebuilt and orientation flag is set to normal in all metadata types (Exif, Thumbnail, TIFF, etc.).

SOFTWARE VERSIONS
digikam-6.0.0-beta2-20181030T031645-x86-64.appimage

OTHER INFORMATION
The inconsistency of orientation flag in metadata seems to have different impact on different actions (autorotate, rotate manually in Thumbnails view, in Preview View).
Comment 1 Milan Knížek 2018-10-30 19:36:18 UTC
The prior version digikam-6.0.0-beta2-20181015T071907-x86-64.appimage seems to work as expected.
Comment 2 Maik Qualmann 2018-10-30 19:39:52 UTC
Gilles must create a new AppImage, this has a problem with write item information to the DB.

Maik
Comment 3 caulier.gilles 2018-10-30 19:53:24 UTC
Maik, AppImage have been updated today evening with your commit from this morning.

Gilles
Comment 4 Maik Qualmann 2018-10-31 08:19:23 UTC
Milan,

can you please test it with the latest AppImage? Your version of time 03:16:45 was affected by the error. New version is: digikam-6.0.0-beta2-20181030T175240-x86-64.appimage

Maik
Comment 5 Milan Knížek 2018-10-31 18:39:34 UTC
This one works again.

However, I am still wondering if it is a problem that even after rotation (which sets the Orientation Flag to "Normal"), the flag for thumbnail is still reported as "rotated" (even after rebuilding the thumbnails):

$ exiv2 -pa z2.jpg | grep -a rientat
Exif.Image.Orientation                       Short       1  top, left
Exif.Thumbnail.Orientation                   Short       1  right, top
Xmp.tiff.Orientation                         XmpText     1  top, left

It does not seem to cause problem in digiKam Preview view, in EOG, in Geeqie - all show the thumbnail properly.

The Exif.Thumbnail.Orientation flag is removed when the image is edited in digiKam's editor and saved.

Shouldn't it be either synced with the image orientation or removed also within Rotation actions in digiKam?
Comment 6 Milan Knížek 2018-10-31 19:37:02 UTC
One app is confused with out of sync orientation flag - the default Gallery app in Samsung S7. It displays the embedded thumbnail as per Exif.Image.Orientation and ignores Exif.Thumbnail.Orientation.

It is probably Samsung's bug, but anyway, wouldn't it be safer to have the image and embedded thumbnail orientation in sync?
Comment 7 Maik Qualmann 2018-10-31 20:16:57 UTC
I do not see a mistake here.

Only very few cameras have Exif.Thumbnail.Orientation, yes Samsumg is one.

If you only rotate the indicator, digiKam also updates Exif.Thumbnail.Orientation.

If you rotate the image lossless, only the main image is rotated, the preview image is not. I do not know if LibJpeg can also rotate the embedded preview image lossless, I do not think so.

This is of course different with the image editor, as it always generates new image data and also generates a new preview image.

Maik
Comment 8 Maik Qualmann 2018-10-31 20:25:13 UTC
In your case, so it works with the Samsung Gallery app, I would only rotate the indicator.

Maik
Comment 9 Milan Knížek 2018-10-31 22:38:56 UTC
The thing is, the flag for thumbnail does not rotate - it stays as it was originally (from camera) and the thumbnail rotates physically. 

Try show the exif metadata in the right hand pane, filter for orientation flag and rotate the image.

In other words, originally both flags might be "rotated right", but when I rotate the image, then the image flag gets set to 'normal', while the thumbnail flag remains 'rotated right'. In order to get the thumbnail displayed correctly (in Digikam), digiKam must actually physically rotate it, too.


The trouble is, that the above behaviour unsyncs the flags and the thumbnail is not shown properly anymore (in Samsung Gallery app).
Comment 10 Maik Qualmann 2018-11-01 19:31:39 UTC
Git commit 866ccbc40a9796ccfda20f7026bd690bea65a99a by Maik Qualmann.
Committed on 01/11/2018 at 19:30.
Pushed by mqualmann into branch 'master'.

fix write orientation flag to Exif.Thumbnail.Orientation
FIXED-IN: 6.0.0

M  +2    -1    NEWS
M  +5    -4    core/libs/jpegutils/jpegutils.cpp
M  +1    -3    core/libs/metadataengine/engine/metaengine_image.cpp

https://commits.kde.org/digikam/866ccbc40a9796ccfda20f7026bd690bea65a99a
Comment 11 Milan Knížek 2018-11-03 12:01:02 UTC
Thanks Maik, the latest digikam-6.0.0-beta3-20181102T200629-x86-64 works fine.
Comment 12 caulier.gilles 2018-11-03 13:10:22 UTC
Thanks Milan for the feedback.
Gilles Caulier