Plain SVG export [cli]: '-i -j' fails to fit page size correctly (rev >= r13268)

Bug #1306662 reported by su_v on 2014-04-11
46
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Mc

Bug Description

Steps to reproduce:

1) launch current trunk with default (new) prefs, default new document (non-localized)
2) draw a rect in the center of the page
3) save
4) on the command line, query the object id:

$ inkscape -f drawing.svg --query-all

5) export just the rect to PNG:

$ inkscape -f drawing.svg -i rectXXXX -j -e drawing-rect.png

5) export just the rect to a plain SVG file:

$ inkscape -f drawing.svg -i rectXXXX -j -l drawing-rect-plain.svg

6) compare PNG and SVG export

Expected result:
The document size fits tightly around the visual bbox of the selected object, both in PNG and SVG.

Actual result:
In the exported Plain SVG file, the page borders have been adjusted to match the object's visual bbox size, but the object itself is vertically offset (outside the page borders), and the page area is empty.

Note: the new features committed in r13268 are undocumented at this point (the man page needs to be updated accordingly)
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/13268>

Reproduced with Inkscape 0.48+devel r13279 on OS X 10.7.5.

Related branches

su_v (suv-lp) on 2014-04-11
description: updated
su_v (suv-lp) on 2014-04-11
summary: - trunk: '-i -j' for plain SVG export fails to adjust page size correctly
+ trunk: '-i -j' for plain SVG export fails to fit page size correctly
(rev >= r13268)

Confirmed on Windows XP, Inkscape trunk revision 13293.

Changed in inkscape:
status: New → Confirmed
jazzynico (jazzynico) wrote :

> the man page needs to be updated accordingly

New report (affecting inkscape-docs too): Bug #1310266 "Update the man page with '-i -j' for plain SVG export options".

Martin Owens (doctormo) on 2014-04-23
Changed in inkscape:
assignee: nobody → Martin Owens (doctormo)
su_v (suv-lp) wrote :

Another test case which exposes a mismatch of object position and page area is described here:
<https://bugs.launchpad.net/inkscape/+bug/171230/comments/8>

Andreas Böhrnsen (deepflame) wrote :

Same issue on Inkscape 0.91pre2 r13516 with Debian Jessie.

Is there a workaround?
Or can it be adjusted automatically afterwards?

Thanks

Andreas Böhrnsen (deepflame) wrote :

Hi! Any reply would be highly appreciated. Thanks

Martin Owens (doctormo) wrote :

No work-arounds for command line action. Will have to wait for a fix.

Andreas Böhrnsen (deepflame) wrote :

Ok, thanks Martin

su_v (suv-lp) wrote :

New testcase for export failure attached by jimmac in original (closed) bug #171230:

On 2015-02-20 17:05 (+0100), Jakub Steiner wrote:
> This is the "source" master plate I want to export with:

https://bugs.launchpad.net/inkscape/+bug/171230/+attachment/4323377/+files/gnome-stencils.svg

> inkscape -f gnome-stencils.svg -l folder.svg -i g4958 -j

> the result of the previous operation: a blank canvas, with the object
> offset down below.

https://bugs.launchpad.net/inkscape/+bug/171230/+attachment/4323378/+files/folder-symbolic.svg

Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.92
su_v (suv-lp) wrote :

@Martin - any plans to work on a fix in the near future? Keeping it assigned may discourage other volunteers to take a closer look at what's needed to make this long-requested feature actually useful … The latest librsvg release now includes an option to export per id [1], and will likely soon be favored over Inkscape by Gtk+ icon designers for splitting icon stencil files into individual icons.

--
[1] librsvg 2.40.11: the current implementation is a partial one (better suited for PNG export), as explained in the NEWS section:
https://git.gnome.org/browse/librsvg/commit/?id=1c420d7961befc69a558184cea399d7f4fc8ee8d
https://bugzilla.gnome.org/show_bug.cgi?id=520654
https://git.gnome.org/browse/librsvg/commit/?id=fecfcce44a959daff80a4e0f9ced83d7cdcb5903

su_v (suv-lp) on 2015-10-09
summary: - trunk: '-i -j' for plain SVG export fails to fit page size correctly
- (rev >= r13268)
+ Plain SVG export [cli]: '-i -j' fails to fit page size correctly (rev >=
+ r13268)
Martin Owens (doctormo) wrote :

An excellent point. Thanks for the prod.

Changed in inkscape:
assignee: Martin Owens (doctormo) → nobody
EmanueleSabetta (fmuaddib) wrote :

Any hope to see this fixed anytime soon? SVG icons are now widely used in developing mobile apps, and are replacing bitmaps. Scripts like this ( https://github.com/berteh/svg-objects-export/ ) are now used to export svg groups as separate svg icon files instead of png, and are affected by this bug. I develop for Android on OSX and I cannot export my icons in vector format because of this bug. Please fix this. Thank you.

Mc (mc...) wrote :

I have no idea why (I see no rational reason why, I just wanted to simplify the code after failing to understand the source of this bug), but r15218 appears to fix this bug.

Changed in inkscape:
milestone: 0.92 → 0.93
assignee: nobody → Mc (mc...)
status: Confirmed → Fix Committed
EmanueleSabetta (fmuaddib) wrote :

This is a great news! So we can finally export indivual elements or groups by id now? They are transformed correctly and a new viewBox is generated that fits the group?

EmanueleSabetta (fmuaddib) wrote :

@Mc is there a dev build for 0.93 that I can download with the fix?

Mc (mc...) wrote :

For which OS ?

sudo add-apt-repository ppa:inkscape.dev/trunk && sudo apt-get update && sudo apt-get install inkscape
to try the bleeding edge dev version on ubuntu-like systems

EmanueleSabetta (fmuaddib) wrote :

For OS X

Ruben (chipairon) wrote :

@Mc I added the trunk ppa and reinstalled inkscape, but I don't think I have the right build:

sudo apt-cache policy inkscape-trunk
inkscape-trunk:
  Installed: 1:0.91.0+devel+15384+77~ubuntu14.04.1
  Candidate: 1:0.91.0+devel+15388+77~ubuntu14.04.1
  Version table:
     1:0.91.0+devel+15388+77~ubuntu14.04.1 0
        500 http://ppa.launchpad.net/inkscape.dev/trunk/ubuntu/ trusty/main amd64 Packages
 *** 1:0.91.0+devel+15384+77~ubuntu14.04.1 0
        100 /var/lib/dpkg/status
     0.48.5+27~ubuntu14.04.1 0
        500 http://ppa.launchpad.net/inkscape.dev/stable/ubuntu/ trusty/main amd64 Packages

Shouldn't it say 0.93 instead of 0.91?
In any case I have also installed 0.92pre5 from the tarball and this problem still exists.

Couldn't the extraction code do what this command line do to get the desired result?
inkscape --verb FitCanvasToDrawing --verb=FileSave --verb=FileClose logo.svg

Mc (mc...) wrote :

0.93 is still far from released.
You need the trunk devel ppa : something like " sudo add-apt-repository ppa:inkscape.dev/trunk && sudo apt-get update && sudo apt-get install inkscape "

su_v (suv-lp) wrote :

@Mc - I think trunk from Inkscape's PPA is called 'inkscape-trunk', installing 'inkscape' will install the stable package. For trunk from PPA, I use this on Ubuntu 14.04:
$ sudo apt-get install inkscape-trunk

And yes, the PPA name of 'inkscape-trunk' is outdated - trunk self-identifies as '0.92+devel', try with:
$ inkscape -V

On 2017-01-04 14:03 (+0100), Ruben wrote:
> In any case I have also installed 0.92pre5 from the tarball and this
> problem still exists.

Please note the milestone of this bug report (0.93): the fix is not part
of Inkscape 0.92 - it will be available in the next major release
Inkscape 0.93, and for testers it is available in current unstable trunk
(Inkscape 0.92+devel).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.