--export-plain-svg adds unnecessary transform

Bug #1707368 reported by Goombert on 2017-07-29
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Patrick Storz

Bug Description

Trying to export an object from an SVG in the latest Inkscape doesn't seem to work from the command line. It keeps adding a translation to my object that isn't even in the original. If you see the attached SVG you can see there are no defs or translations at all, so it makes no sense why it moves the entire sprite by about 80px.

Using the following on the attached example SVG:
$ inkscape "example.svg" --vacuum-defs --export-id="Icon_Sprite" --export-id-only --export-plain-svg="sprite.svg"

I get the following translation added to the group in the output SVG:
  <g
     transform="translate(-2.5,-83.5)"
     id="Icon_Sprite">

Goombert (goombert84) wrote :
Alvin Penner (apenner) wrote :

confirmed on Windows 10, Inkscape 0.92.1 r15371

just for the record, the value 'translate(2.5,83.5)' agrees perfectly with the coordinates of the lower left hand corner of the object relative to the lower left hand corner of the page, if you load this file into the gui and choose the ignore option.

Changed in inkscape:
status: New → Confirmed
Alvin Penner (apenner) wrote :

attached is a second example, just in case this problem was somehow related to the fact that this was a legacy file from 0.91.
    the attached file was created entirely in 0.92.1 using the template file default_px.svg. Then the icon object was copied and pasted into it using a text editor, not Inkscape.
When I perform the above export command in DOS I get an offset of transform="translate(-2.5,-1106.0197)" which again agrees with the coordinates of the object in the gui. In this case the exported object is far off the page so that it is not visible in the exported file unless one zooms out a lot.

Alvin Penner (apenner) wrote :

not reproduced on Inkscape 0.47pre1

Goombert (goombert84) wrote :

Thanks! I understand, so the desired outcome is some way of exporting the icons easily without these transforms. In the original SVG there is 1 root group used as a layer with id "Layer_Icons" and then inside that is where "Icon_Sprite" "Icon_Background" and all of the other icons are. We have already wrote a script that loops through the id's of the SVG and calls the command line like this. But we would ideally want to export them with a canvas size of 18x18 that is centered and with the defs minified/vacuumed/cleaned out. One problem with this setup is that the parent group of all the icons is also exported and I believe that could be the cause of why --vacuum-defs does not work either, but even after I ungrouped them from the parent --vacuum-defs still did not work either.

Patrick Storz (ede123) wrote :

This issue seems fixed in current master, i.e. Inkscape 0.92+devel (4c394ff20a, 2017-10-14).

There's still a transform of "translate(-2.5,-2.5)", but that is to be expected as Inkscape rescales the canvas to fit the (remaining) drawing by default (and needs to move the object to the upper left corner in the process).

If somebody can figure out which commit fixed it in master we can backport it to 0.92.x.

Patrick Storz (ede123) wrote :

Ah sorry, forget the commit has (it's a local branch based on 5433ac0513099a4a12caba0cda8a2a9d30e13a22)

Patrick Storz (ede123) wrote :

Transform issue fixed in 0.92.x in
https://gitlab.com/inkscape/inkscape/commit/a355c6b862bf24a851ee42b3ace354bd29fb7d1b

See bug #1306662 for details.

The --vacuum-defs option is working fine for me.

If you should still require a feature to export without any transform at all I suggest you create a separate feature request. However removing the remaining transform would require to modify path data which probably is not a desired results in most cases.

Changed in inkscape:
status: Confirmed → Fix Committed
importance: Undecided → Medium
milestone: none → 0.92.3
assignee: nobody → Eduard Braun (eduard-braun2)
tags: added: cli exporting svg
removed: 0.92.1
Bryce Harrington (bryce) on 2018-05-12
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers