Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

Cropping .svg files on the command line is simple: $ inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose *.svg

I need to do the opposite. I want to fit the drawing into a 64 x 64 points canvas (already set in all .svg files). Unfortunately Inkscape doesn't provide a FitDrawingToCanvas command. Moreover, the fitting should keep the aspect ratio of the drawing.

If it matters: I'm using Ubuntu raring.

share|improve this question
Would resize after fitting the canvas to drawing do the job? See graphicdesign.stackexchange.com/questions/6574/… –  Takkat Oct 30 '13 at 19:25
Two questions: (1) the canvas size is already set in each instance, but the drawings are larger than the canvas; or are you inserting an svg drawing into a different svg document?; (2) "keep aspect ratio": this is confusing in light of the 64pt square canvas mentioned in your questions, but do you have a proposed automated decision process for how to handle non-square material? e.g. the height should be 64pt in all cases... –  horatio Oct 30 '13 at 20:37
@Takkat: Thanks for the hint. The workflow works, but the aspect ratio gets destroyed. Will look for a solution for that... –  Stefan Endrullis Oct 30 '13 at 21:55
@horatio: (1) the drawing in smaller than the canvas and yes, both are in the same file. (2) I want to scale the drawing to the point that max(drawingWidth, drawingHeight) = 64pt. –  Stefan Endrullis Oct 30 '13 at 22:00
@Takkat: rsvg-convert has an argument --keep-aspect-ratio :) –  Stefan Endrullis Oct 30 '13 at 22:07

1 Answer 1

You you need to change the output save pattern from 's/svg$/filename.svg/' to 's/svg$/png/', and you enter the width and height that you want as the pixel values.

for i in *; do rsvg-convert $i -w 64-h 64 -f png -o echo $i | sed -e 's/svg$/png/'; done

share|improve this answer
Wont that produce a PNG? –  DumbNic Oct 23 at 14:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.