Bug 115934 - Bad position for rotated images (use unrotated image position values)
Summary: Bad position for rotated images (use unrotated image position values)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.1.1 release
Hardware: x86-64 (AMD64) All
: high normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: implementationError
: 116515 117264 117855 120314 126550 132949 137064 152025 153765 (view as bug list)
Depends on:
Blocks: Writer-Images Image-Dialog Regress-Rotated-Images
  Show dependency treegraph
 
Reported: 2018-02-22 11:01 UTC by Regina Henschel
Modified: 2023-03-23 23:54 UTC (History)
19 users (show)

See Also:
Crash report or crash signature:


Attachments
rotated image wrong vertical position (13.30 KB, application/vnd.oasis.opendocument.text)
2018-02-22 11:01 UTC, Regina Henschel
Details
rotated shape correct vertical position (11.44 KB, application/vnd.oasis.opendocument.text)
2018-02-22 11:01 UTC, Regina Henschel
Details
Simple document to test behavior (12.16 KB, application/vnd.oasis.opendocument.text)
2018-03-01 18:22 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2018-02-22 11:01:17 UTC
Created attachment 140054 [details]
rotated image wrong vertical position

Open attached document. It contains an image that is anchored to the paragraph before "after". It has the wrap parallel, follow text flow, and vertical align top to paragraph text area. Therefore it should be below the text of the previous paragraph.

Open the second attachment. It has the same settings, but for a shape. There you can see, where the image should be.
Comment 1 Regina Henschel 2018-02-22 11:01:52 UTC
Created attachment 140055 [details]
rotated shape correct vertical position
Comment 2 Regina Henschel 2018-02-22 13:37:07 UTC
It seems, that positioning uses the values from the unrotated image instead of the values from the bounding box.
Comment 3 Jacques Guilleron 2018-02-24 10:29:16 UTC
Hi Regina,

reproduced with
LO  6.0.1.1 (x64) Build ID: 60bfb1526849283ce2491346ed2aa51c465abfe6
Threads CPU : 2; OS : Windows 6.1; UI Render : par défaut; 
Locale : fr-FR (fr_FR); Calc: CL
Rotate 20°.odt is right positionned (but not rotated, obviously) with
LO  5.3.1.1 Build ID: 72fee18f394a980128dc111963f2eefb05998eeb
Threads CPU : 2; Version de l'OS :Windows 6.1; UI Render : par défaut; Moteur de mise en page : nouveau; 
Locale : fr-FR (fr_FR); Calc: CL
Comment 4 Regina Henschel 2018-03-01 16:46:30 UTC
5.3 has no rotated images. This issue is about the new feature in version 6.
Comment 5 Regina Henschel 2018-03-01 18:22:25 UTC
Created attachment 140271 [details]
Simple document to test behavior

The image is set to "right to Paragraph area" and " From top 4cm to Margin".

Rotate the image to 90°.
Expected behavior: The rotated image is positioned at the right edge of the paragraph area and the top edge if 4cm below the start edge of the paragraph.

Drag the image to the right edge of the text area. Notice, that it will jump back.
Comment 6 Regina Henschel 2018-03-01 18:35:58 UTC
Armin, please have a look. It seems, that size and position of the unrotated image is used for layout. In case you have no time to fix it, do you have a pointer where to look?
Comment 7 Regina Henschel 2018-03-04 10:50:58 UTC
The state of the object is inconsistent after rotation. After rotation the alignment can no longer be "right". Rotating a Draw-image, which had alignment "right", the alignment changes to "From left". That should be done here too.
Comment 8 Regina Henschel 2018-05-03 10:43:01 UTC
*** Bug 117264 has been marked as a duplicate of this bug. ***
Comment 9 Regina Henschel 2018-05-28 23:14:28 UTC
*** Bug 117855 has been marked as a duplicate of this bug. ***
Comment 10 Regina Henschel 2018-11-05 21:55:21 UTC
*** Bug 116515 has been marked as a duplicate of this bug. ***
Comment 11 Regina Henschel 2019-07-26 11:07:53 UTC
*** Bug 126550 has been marked as a duplicate of this bug. ***
Comment 12 ajlittoz 2020-06-04 21:26:27 UTC
See if bug 125594 is a duplicate of this one
Comment 13 Dieter 2020-09-27 06:05:01 UTC
*** Bug 137064 has been marked as a duplicate of this bug. ***
Comment 14 Telesto 2021-01-03 16:59:02 UTC
(In reply to Regina Henschel from comment #5)
> Created attachment 140271 [details]
> Simple document to test behavior
> 
> The image is set to "right to Paragraph area" and " From top 4cm to Margin".
> 
> Rotate the image to 90°.
> Expected behavior: The rotated image is positioned at the right edge of the
> paragraph area and the top edge if 4cm below the start edge of the paragraph.
> 
> Drag the image to the right edge of the text area. Notice, that it will jump
> back.

@Regina
Are comment 0 and comment 5 about exactly the same thing. I'm free to move the image with LibO 5.4. The second example appears to be a regression, IMHO
Comment 15 Dieter 2021-04-01 09:53:04 UTC
*** Bug 120314 has been marked as a duplicate of this bug. ***
Comment 16 bagaresalken 2022-02-25 04:03:57 UTC
When you extract a document with a rotated image(should be from `libreoffice-writer`) and read the `content.xml` from the extracted document, you will see something like this:

'''
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3"><office:scripts/><office:font-face-decls><style:font-face style:name="Droid Sans Devanagari" svg:font-family="&apos;Droid Sans Devanagari&apos;" style:font-family-generic="swiss"/><style:font-face style:name="Droid Sans Devanagari1" svg:font-family="&apos;Droid Sans Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Droid Sans Fallback" svg:font-family="&apos;Droid Sans Fallback&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Source Han Sans CN" svg:font-family="&apos;Source Han Sans CN&apos;" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style><style:style style:name="fr2" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style></office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/><text:sequence-decl text:display-outline-level="0" text:name="Figure"/></text:sequence-decls><text:p text:style-name="Standard"><draw:frame draw:style-name="fr2" draw:name="Image1" text:anchor-type="char" svg:width="20.362cm" svg:height="9.382cm" draw:z-index="0"><draw:image xlink:href="Pictures/10000001000009C400000480598A9AABBF078639.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="image/png"/></draw:frame><draw:frame draw:style-name="fr1" draw:name="Image2" text:anchor-type="char" svg:x="-3.23cm" svg:y="12.608cm" svg:width="20.362cm" svg:height="9.382cm" draw:z-index="1" draw:transform="translate (-6.951cm -17.299cm) rotate (4.71238898038469) translate (6.951cm 17.299cm)"><draw:image xlink:href="Pictures/10000001000009C400000480598A9AABBF078639.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="image/png"/></draw:frame></text:p></office:text></office:body></office:document-content>
'''

Notice the tag `draw:frame`, it contain values `svg:width` and `svg:height` which tells the editor the width and the height of the image.

The `draw:frame` tag of the unrotated image:

'''
<draw:frame draw:style-name="fr2" draw:name="Image1" text:anchor-type="char" svg:width="20.362cm" svg:height="9.382cm" draw:z-index="0"><draw:image xlink:href="Pictures/10000001000009C400000480598A9AABBF078639.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="image/png"/></draw:frame>
'''

The `draw:frame` tag of the rotated image:

'''
<draw:frame draw:style-name="fr1" draw:name="Image2" text:anchor-type="char" svg:x="-3.23cm" svg:y="12.608cm" svg:width="20.362cm" svg:height="9.382cm" draw:z-index="1" draw:transform="translate (-6.951cm -17.299cm) rotate (4.71238898038469) translate (6.951cm 17.299cm)"><draw:image xlink:href="Pictures/10000001000009C400000480598A9AABBF078639.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="image/png"/></draw:frame>
'''

Noticed that they both have the same width and height, if we could somehow allow libreoffice to accept negative values or do it the proper way, change the width and height depending of the rotation.
Comment 17 Dieter 2022-02-25 07:50:15 UTC
I've changed priority to "high" because of the numbers of duplicates.
Comment 18 Gabor Kelemen (allotropia) 2022-03-03 07:10:35 UTC
Seems to have started in this range, when image rotation support was implemented in 6.0:

https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=6675e6eaf999de94d49d7644d5877537fda83239..d74b26b41bfea3ba7a1834953b2bfe9b7ff0d70f
Comment 19 Romain Bazile 2022-06-10 12:11:28 UTC
This still exist in 7.3.3.

130079 is a probable duplicate of this bug.
Comment 20 Stéphane Guillou (stragu) 2022-11-14 23:42:48 UTC
*** Bug 132949 has been marked as a duplicate of this bug. ***
Comment 21 Stéphane Guillou (stragu) 2022-11-14 23:45:10 UTC
*** Bug 152025 has been marked as a duplicate of this bug. ***
Comment 22 Stéphane Guillou (stragu) 2023-03-23 23:54:18 UTC
*** Bug 153765 has been marked as a duplicate of this bug. ***