please provide complete examples #77
Unanswered
Yellow-Subroutine
asked this question in
Q&A
Replies: 1 comment
-
Let's use the following for a script that generates an image: big_radius = min(width, height)/3
small_radius = big_radius/10
for angle in range(0, 360, 5):
x = big_radius*cos(angle*pi/180) + width/2
y = big_radius*sin(angle*pi/180) + height/2
circle((x, y), small_radius) I can think of two ways to save the resulting image to a file. One option is to run the extension from the command line, specifying an output file: env PYTHONPATH=/usr/share/inkscape/extensions:$PYTHONPATH python ~/.config/inkscape/extensions/simple_inkscape_scripting/simpinkscr/simple_inkscape_scripting.py --py-source=my-script.py --output=my-output.svg /usr/share/inkscape/templates/default.svg An alternative is to add the following to the script itself to save its output to a file and run the script from the Inkscape GUI: with open('my-output.svg', 'w') as w:
w.write(svg_root.tostring().decode('utf-8')) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I would like to programmatically generate sgvs and came across this extension.
It looks very powerful, however from perusing the documentation it is not at all clear to me how to save the generated images to disk, at least I cannot find any methods to do that.
So could you please provide a complete example of how to programmatically creating an sgv using this extension, including saving the file?
I am very sorry for maybe asking something trivial, but I don't have much inkscape experience...
Beta Was this translation helpful? Give feedback.
All reactions