running FileSave verb from command line doesn't work

Bug #168616 reported by Bug Importer
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Unassigned

Bug Description

Calling inkscape from commandline in following way:

inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose
drawing.svg

doesn't work as expected - drawing.svg remains unchanged.

Tags: cli saving
Revision history for this message
Tom Davidson (tjd-mit) wrote :

Funny thing, though: FitCanvasToSelectionOrDrawing *does* work:
 $ inkscape --verb=FitCanvasToSelectionOrDrawing --verb=FileSave --verb=FileClose drawing.svg ; See Bug 171511 .

The problem is that FitCanvasToDrawing doesn't 'dirty' the file, so Saving has no effect. You can verify this by just calling the first verb:
 $ inkscape --verb=FitCanvasToDrawing drawing.svg

The drawing resizes as expected, but if you close Inkscape, you don't get the dialog asking if you want to save your changes. The changes really are there though: if you choose File->Save As, then the resulting file is cropped as you'd expect. Hmm...

Another, possibly related issue is that if you use the -z or --without-gui command line option (which is supposed to suppress the GUI), then many other verbs also don't result in changes being saved:

$ inkscape -z --verb=FitCanvasToSelectionOrDrawing --verb=FileSave --verb=FileClose drawing.svg ;
$ inkscape -z --verb=EditSelectAll --verb=SelectionUnGroup --verb=FileSave tree.svg

This is all confirmed in latest SVN (rev 17195) under Linux.

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Aurium (aurium) wrote :

I'm using inkscape from svn rev21113

The FileSave (or may be all verbs) works with GUI, but not without.

If you use without -z (same as --without-gui) that will save the change.
inkscape-svn -z --select=bola --select=rect --verb=SelectionDiff --verb=FileSave --verb=FileQuit desenho.svg; inkscape-svn desenho.svg

The problem will occur with "inkscape --shell" too.

jazzynico (jazzynico)
tags: added: cli
Revision history for this message
Phil Stone (philstone) wrote :

It looks like the -z (--without-gui) option disables the --verb parms.

Here is an example that will turn everything into paths, including text and boxes, which works without the -z

inkscape --verb EditSelectAllInAllLayers --verb ObjectToPath --verb FileSave --verb FileClose test.svg

But which does nothing with the -z

inkscape -z --verb EditSelectAllInAllLayers --verb ObjectToPath --verb FileSave --verb FileClose test.svg

Revision history for this message
Cefn (6-launchpad-net-cefn-com) wrote :

Independently encountered exactly the same when trying to do the same batch transformation, with my script like...

# eliminate all objects and text with fonts - turn into paths
find . -name '*.svg' | xargs -n1 inkscape --without-gui --verb=EditSelectAll --verb=ObjectToPath --verb=FileSave --verb=FileQuit

...and found the same issue. Works fine until I try to run it without a GUI.

Perhaps it's just impossible to actually support command line control without loading up into X (for example my command relies on font loading to turn text in to paths).

This command line control is still useful compared to pointing and clicking, but if I get this working by removing --without-gui then loading up the GUI seems to take forever for each line. The need to launch a window also means I can't use this tool headless in a server context.

Is there any decision what should be done about this important missing feature, and in the meantime are there any workarounds for the ObjectToPath scenario outlined in my command line, perhaps piping things into a --shell or manually dirtying the file somehow.

Revision history for this message
su_v (suv-lp) wrote :

> The problem is that FitCanvasToDrawing doesn't 'dirty' the file
and
> Funny thing, though: FitCanvasToSelectionOrDrawing *does* work:

Reproduced with Inkscape 0.46 (released 2008-03-11) on OS X 10.5.8
Not reproduced with Inkscape 0.47 (released 2009-11-21), 0.48.x and current trunk (r11422) on OS X 10.7.4: the verb does dirty the document as expected and prompts to save the modified file if omitting the argument '--verb=FileSave'.

Closing this report as 'Fix Released' with milestone 0.47.

> It looks like the -z (--without-gui) option disables the --verb parms.

This second issue mentioned in the comments is now tracked in a separate report:
  Bug #843260 “Allow suppressing the GUI (-z) when using --verb option(s)”
  <https://bugs.launchpad.net/inkscape/+bug/843260>

Changed in inkscape:
milestone: none → 0.47
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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