Bug 146019 - Always insert rotated image if it has EXIF rotation
Summary: Always insert rotated image if it has EXIF rotation
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Gabor Kelemen (allotropia)
URL:
Whiteboard: target:7.4.0 target:7.3.0.0.beta2
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks: Images
  Show dependency treegraph
 
Reported: 2021-12-03 03:20 UTC by Aron Budea
Modified: 2022-06-14 15:01 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2021-12-03 03:20:50 UTC
When an image with EXIF rotation [1], eg. attachment 176569 [details] is inserted, there is/used to be a dialog that asks the user whether they want to insert the rotated or unrotated image.
This dialog was removed in Writer with the below commit, but it's still there:
- in Calc, Impress and Draw, when inserting images,
- in each app when the image is dragged into it from outside, eg. the OS file manager.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=baadefe9cb8e6745493b0c383e1d66ff3905d153
author		Marco Cecchetti <marco.cecchetti@collabora.com>	2019-10-20 18:28:07 +0200
committer	Marco Cecchetti <marco.cecchetti@collabora.com>	2020-03-06 10:39:26 +0100

The goal would be to remove this dialog in the remaining places, and always insert the image in the rotated state based on EXIF. The dialog itself was added sometimes between 4.0 and 4.1, before that this rotation hadn't been implemented. Considering the users will probably always choose the option to rotate the image (the unrotated state is the camera's orientation, described in [1]), the dialog is unnecessary.

Code pointers can be found in the above commit, and in the commits of bug 145819.

Attachment 176569 [details] can be used to verify the behavior, the house should be rotated 90 degrees clockwise if the EXIF data is taken into account.

Making this a beginner level easy hack, but feel free to adjust that.

[1] https://jdhao.github.io/2019/07/31/image_rotation_exif_info/
Comment 1 Tomaz Vajngerl 2021-12-03 09:50:50 UTC
"git grep GraphicNativeMetadata" should bring you very near to the places where the dialog is created and called.
Comment 2 Commit Notification 2021-12-17 16:34:44 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/30f6ad6a617e7b9aa86f774e8b6da9c4ae8ad9f4

tdf#146019 Remove confirmation dialog about applying images EXIF rotation

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2021-12-20 14:25:48 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/dd5e7b2120898b96132ed4d330adb597991c1f6b

tdf#146019 Remove confirmation dialog about applying images EXIF rotation

It will be available in 7.3.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2021-12-20 19:40:57 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e2cd50d80c229bc58cf9d8867f8506c720f2e17d

tdf#146019: sd: Add UItest

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.