Bug 39206 - Images embedded in SVGs are imported at the wrong position
Summary: Images embedded in SVGs are imported at the wrong position
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Samuel Mehrbrodt (CIB)
QA Contact:
URL:
Whiteboard: target:4.3.0 target:4.2.0.1 target:4.1.5
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-13 13:03 UTC by Federico Mena-Quintero
Modified: 2013-12-29 20:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample SVG file with embedded image (51.25 KB, image/svg+xml)
2011-07-13 13:03 UTC, Federico Mena-Quintero
Details
Screenshot of bad import (255.27 KB, image/png)
2011-07-13 13:05 UTC, Federico Mena-Quintero
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Mena-Quintero 2011-07-13 13:03:52 UTC
Created attachment 49056 [details]
Sample SVG file with embedded image

See the attached SVG file.  When I do "Insert/Picture/From file" in Impress, the SVG gets imported correctly, but the embedded bitmapped image is put in the wrong position.
Comment 1 Federico Mena-Quintero 2011-07-13 13:05:22 UTC
Created attachment 49057 [details]
Screenshot of bad import
Comment 2 Björn Michaelsen 2011-12-23 12:25:27 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 3 Florian Reisinger 2012-08-14 14:01:01 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 4 Florian Reisinger 2012-08-14 14:02:08 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 5 Florian Reisinger 2012-08-14 14:06:47 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 6 Florian Reisinger 2012-08-14 14:08:50 UTC
Dear bug submitter!

Due to the fact, that there are a lot of NEEDINFO bugs with no answer within the last six months, we close all of these bugs.

To keep this message short, more infos are available @ https://wiki.documentfoundation.org/QA/NeedinfoClosure#Statement

Thanks for understanding and hopefully updating your bug, so that everything is prepared for developers to fix your problem.

Yours!

Florian
Comment 7 sasha.libreoffice 2012-09-28 11:04:42 UTC
reproduced in 3.6.1 on Fedora 64 bit
used File->Open and opened file from first attachment
(drag and drop works correctly)
Comment 8 Samuel Mehrbrodt (CIB) 2013-09-06 10:34:54 UTC
For me it is fixed in 4.1.1.

Can you confirm that?
Comment 9 sasha.libreoffice 2013-09-06 10:39:42 UTC
bug reproduced in 4.1.1 on Fedora (RFR) 64 bit
use File->Open menu item in LO
Comment 10 Owen Genat (retired) 2013-12-07 04:36:42 UTC
This appears to be a problem with LO not taking the transform attribute of the g element into consideration. 

http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

The provided SVG contains:

> <g
>      inkscape:label="Layer 1"
>      inkscape:groupmode="layer"
>      id="layer1"
>      transform="translate(0,-287.36218)">
...
> <image y="341.99582" x="536.0332" ...

While it is unusual for the Y coord to be listed before the X coord in the image element, this is likely still valid. The raster image is in Layer 1. Opening the SVG in Draw under Ubuntu 10.04 x86_64 running:

- v3.3.0.4 OOO330m19 Build: 6
- v3.4.6.2 OOO340m1 Build: 602
- v3.5.7.2 Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b
- v3.6.7.2 Build ID: e183d5b
- v4.0.6.2 Build ID: 2e2573268451a50806fcd60ae2d9fe01dd0ce24
- v4.1.3.2 Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a

... reveals these coordinates in all cases:

Position X: 536.0pt (18.91cm)
Position Y: 342.opt (12.07cm)

If the translate amount (-287.36218) is added to the Y coord (341.99582) the result is 54.63364. Changing the Y coord in Draw of the raster object to this value appears to result in the expected positioning. In basic terms, even though the page of the SVG is set to be US Letter in landscape orientation, the location of 0,0 is not at the upper left of this area. Instead the translate value is used to place 0,0 where the the top left corner of an A4 sheet in portrait orientation would be.
Comment 11 Owen Genat (retired) 2013-12-07 04:40:51 UTC
I forgot to mention that I also tested opening the provided SVG in Impress (same positional results), but it is easier to manipulate the embedded raster object in Draw. Version set to Inherited From OOo as a result of comment #10.
Comment 12 Samuel Mehrbrodt (CIB) 2013-12-07 11:19:41 UTC
Thanks for the investigation, Owen. I submitted a patch which implements reading the translate and scale attribute for SVG Images: https://gerrit.libreoffice.org/6968
Comment 13 Miklos Vajna 2013-12-08 10:20:59 UTC
Hah, nice. Yesterday I started to track down why images are missing from a graphviz-generated svg file of mine, and noticed the same problem that the current transformation is not applied to images. I implemented the correction of the position in a similar way, but I'm happy to notice your patch, that also handles width / height as well. I'll approve it in a bit.
Comment 14 Commit Notification 2013-12-08 10:23:20 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fb978b8123a47123d184daf390ce17eaacbc05d9

fdo#39206 Add support for image transformation in SVG Import



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2013-12-08 10:51:42 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=09c6257262244456838daf16eb7c034adfeb8fa0&h=libreoffice-4-2

fdo#39206 Add support for image transformation in SVG Import


It will be available in LibreOffice 4.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 16 sasha.libreoffice 2013-12-09 05:10:54 UTC
Thanks for fixing this bug
Comment 17 Commit Notification 2013-12-29 20:58:32 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=050e42346bd2d7ce8ab454df400b48f52c2aeecf&h=libreoffice-4-1

fdo#39206 Add support for image transformation in SVG Import


It will be available in LibreOffice 4.1.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.