select-all : Select all; options: 'all' (every object including groups), 'layers', 'no-layers' (top level objects in layers), 'groups' (all groups including layers), 'no-groups' (all objects other than groups and layers, default)
According to the documentation, 'no-groups' is the default.
I would like to rotate an SVG file on the command-line. I've tried
inkscape --actions "select-all;transform-rotate:90;export-filename:out.svg;export-do" in.svg
This doesn't rotate the canvas though, so I usually end up with a cropped image.
Any hints?
Rotate in svg is acutally rotate(angle_degrees, x, y)
Where x, y are the centre of rotation for the operation.
If not specified they are 0, 0 by default.
So you could do two command lines, with a select-all;query-all and parse the first entry ( which should be the svg dimensions )
Then use the centre obtained from that.
Or you could just cheat.
inkscapecom.com --actions="select-all;transform-rotate:90;fit-canvas-to-selection;export-filename:rotated.svg;export-do" drawing.svg
(inkscapecom.com is for Windows, otherwise just use inkscape)
Please note this will also crop the svg to the dimensions of the selection - so may not be idea.
If you just want to rotate a selection on canvas without resizing, you would have to use the first method (2 command calls)
Thanks for the tip!
fit-canvas-to-selection
would actually work for me, but it fails on the first example I tried it on; see attachment.Might this be a bug in inkscape's embedded raster image handling?
I'm not sure what the error is from the picture.
It could be a problem with the
select-all
select-all : Select all; options: 'all' (every object including groups), 'layers', 'no-layers' (top level objects in layers), 'groups' (all groups including layers), 'no-groups' (all objects other than groups and layers, default)
According to the documentation,
'no-groups'
is the default.Possibly try
select-all:all
?Please note this will also crop the svg to the dimensions of the selection - so may not be idea.