Bug 169376 - FILEOPEN: Image shows rotated
Summary: FILEOPEN: Image shows rotated
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
26.2.0.0 alpha0+ master
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Images
  Show dependency treegraph
 
Reported: 2025-11-11 00:30 UTC by Gerald Pfeifer
Modified: 2025-12-02 18:01 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample document (ODT) (2.57 MB, application/vnd.oasis.opendocument.text)
2025-11-11 00:30 UTC, Gerald Pfeifer
Details
Visual comparision okay (left) - broken (right) (601.40 KB, image/png)
2025-11-11 00:32 UTC, Gerald Pfeifer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerald Pfeifer 2025-11-11 00:30:06 UTC
Created attachment 203859 [details]
Sample document (ODT)

Opening a document created with an earlier version of LibreOffice
(most probably an early 26.2 build) suddenly an image appears rotated
by 90 degree.

This is a regression between

  Version: 25.8.2.2 (X86_64) / LibreOffice Community
  Build ID: 580(Build:2)
  CPU threads: 12; OS: Linux 6.17; UI render: default; VCL: gtk3
  Locale: en-US (en_US.UTF-8); UI: en-US

and the latest nightly build

  Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
  Build ID: 6727fd079a6cb1a7ca6b4521e57357e6ec496fe1
  CPU threads: 12; OS: Linux 6.17; UI render: default; VCL: gtk3
  Locale: en-US (en_US.UTF-8); UI: en-US
Comment 1 Gerald Pfeifer 2025-11-11 00:32:17 UTC
Created attachment 203860 [details]
Visual comparision okay (left) - broken (right)
Comment 2 m_a_riosv 2025-11-11 00:58:55 UTC
Looks like a duplicate of tdf#124615

Please, if you disagree, reopen it.

*** This bug has been marked as a duplicate of bug 124615 ***
Comment 3 Aron Budea 2025-11-11 02:04:32 UTC
Bug 124615 is about DOC, so it's probably something else.
If you right-click the image, open Properties and check rotation, you will find 90 degrees set there, so the rotation is expected. If you reset it, the image becomes upright.

The interesting question is why it was different in older versions, where if you reset rotation, the image is shown rotated to the left.

The change in 26.2 happened with the following commit:
https://git.libreoffice.org/core/commit/0200a718af66ec1e8d2e41e937aaebcd337a147e
author		Andras Timar <andras.timar@collabora.com>	Tue Sep 09 15:09:59 2025 +0200
committer	Andras Timar <andras.timar@collabora.com>	Wed Sep 10 10:23:44 2025 +0200

"tdf#137833 Always respect EXIF Orientation tag when importing a JPEG"

So this rather seems to be a duplicate of bug 137833.

*** This bug has been marked as a duplicate of bug 137833 ***
Comment 4 Gerald Pfeifer 2025-12-02 16:39:55 UTC
This does not actually appear to be a duplicate of bug #137833.

Even with that one fixed, I still see the originally reported behavior,
i.e, LibreOffice 25.8.2.2 and earlier as well as Word (online) show the
expected behavior, whereas current 26.2 snapshots show it off.


Note, I am *not* ignoring Aron's comment #3, alas something odd is
happening.
Comment 5 Aron Budea 2025-12-02 17:03:20 UTC
(In reply to Gerald Pfeifer from comment #4)
> Even with that one fixed, I still see the originally reported behavior,
> i.e, LibreOffice 25.8.2.2 and earlier as well as Word (online) show the
> expected behavior, whereas current 26.2 snapshots show it off.
The fix wasn't backported to 25.8, so the old behavior there is expected. If you read the EXIF data from the picture, you will find the following among them, this is what LO now takes into account (Word probably doesn't):

Orientation                     : Rotate 270 CW
Comment 6 Aron Budea 2025-12-02 18:01:31 UTC
Actually, I need to correct myself, this is indeed interesting. Let's review image info: the image is rotated 90° CW, the EXIF data specifies 270° CW rotation so it stands upright.

When the ODT is opened in 25.8, the image is upright, but because a 90° rotation set among Image settings (Rotation tab). When inserting it newly in this version, it is shown upright, with 90° rotation set.

In an older version, 6.4, the image is upright because of the 90° rotation. When inserting the image newly, the user is offered the choice to apply the rotation or not, in either case, the rotation is directly applied to the image, and no rotation is set among Image settings.

Then since 7.3, when inserting the image, there isn't a dialog anymore, rotation is always applied, this was implemented in bug 146019. Still no rotation is set among Image settings.

Image insertion started behaving differently in 25.8, because of the fix to bug 137848: now the image is inserted in its original orientation, and rotation is applied separately as a setting.

Commit:
https://git.libreoffice.org/core/commit/a6c9519b5f92eab604a8884aa6db4e8f1ac616b3
author		Noel Grandin <noel.grandin@collabora.co.uk>	Fri Jan 17 11:17:33 2025 +0200
committer	Noel Grandin <noel.grandin@collabora.co.uk>	Fri Jan 17 12:16:36 2025 +0100

"tdf#137848 Speed up inserting rotated image"

Summary:
- the image should be upright when the document is opened (original rotation is considered + EXIF rotation is applied as image rotation in Writer),
- when inserting the image, it should be inserted the same way, and shown upright.