Sample Header Ad - 728x90

Crop SVG drawing to canvas size in command line

10 votes
1 answer
6341 views
I have SVG images produced by PlantUML, which has some parts of drawing outside of canvas. It makes it difficult to use such images and I need to crop drawing to canvas size. As I produce UML diagrams with script anyways, it would be really efficient to perform a cropping there as well. So far I've tried two things: a) resize canvas to drawing with Inkscape inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose *.svg This works fine, but I need to crop drawing to canvas size and this operation seems to be unavailable. b) resize with rsvg-convert rsvg-convert image.svg -w 1870 -h 1195 -f svg -o image.svg This does exactly croping to the desired size, but image size increases ~10 times as now there are some binary images embedded into SVG. This is not acceptable for me.
Asked by divanov (251 rep)
May 7, 2014, 12:45 PM
Last activity: Dec 3, 2015, 11:08 AM