How to enlarge SVG files in Python?

164 Views Asked by At

I want to merge several SVG files into one. For this I use the Python library Svgutils. I do this using the following code.

fig = Figure("75cm", "75cm", 
  SVG("_4_KuKaLinienRotate.svg").move(00,-50)
  ,SVG("_4_KuKaLinienRotate.svg").move(00,-100)
  ,SVG("_4_KuKaLinienRotate.svg").move(00,-150)
  ,SVG("_4_KuKaLinienRotate.svg").move(00,-200)).tile(1,4)
fig.save("_5_KuKaLinienRotateDup.svg")

Then I save the file as a PDF.

Output_PDF("_5_KuKaLinienRotateDup.svg","__3_Output_Rotate_Dup_PDF")

If I want to print this now, the pictures are all very small. Now my question is, how can you enlarge the SVG files so that they are no longer so small?

In general how can you use python to enlarge and save an svg file?

1

There are 1 best solutions below

2
On

I am not sure which library you are using here, might be on top of PyX. (There is no SVG().move() etc. in PyX directly. But don't mind.)

In PyX you could either scale the output by a transformation when inserting in a canvas, or you could adjust the resolution (defaults to 96 pt/inch) when loading the SVG file.