Home > OS >  How to execute certain command on Windows program?
How to execute certain command on Windows program?

Time:07-16

So I am opening an SVG file in a program called Inkspace using a script with the os and subprocess package. Once I have opened this file in Inkspace I would like to click save as or some how save as for the image in Inkspace using python. Is there anyway to do this?

CodePudding user response:

I think it is possible. Before closing Inkscape, you need to call Inkscape command for exporting your file via python.

I think something like this will do the job.

import subprocess

# Your current stuff.
# Save the working file before closing Inkscape.
subprocess.run(["inkscape", "--export-type="png", "my_file.svg"])

You can look at the following link for Inkscape command line interface: Inkscape CLI help or type the following in the windows shell to see available commands.

inkscape --help
  • Related