bitmaps from python

Post questions on how to use or achieve an effect in Inkscape.
pelle
Posts: 53
Joined: Wed Mar 05, 2008 8:23 am

bitmaps from python

Postby pelle » Wed Mar 05, 2008 10:36 am

Is there a way from a python extension to export groups to bitmaps, other than starting a new inkscape process with --export-id --export-id-only flags? Ideally for my effect I would like to have the user enter a directory name as parameter to the effect, and then some images will be generated from parts of the drawing and put as png in that directory.
If starting a new inkscape process is the only way, is there a good platform independent way of figuring out what name to use for the binary (inkscape, inkscape.exe, etc)?

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: bitmaps from python

Postby sas » Fri Mar 07, 2008 6:53 am

I don't really know the answer to this, but it does seem that invoking Inkscape is the most feasible option at present.

The name of the Inkscape binary shouldn't be a problem unless the user has changed it. (The extra ".exe" on Windows doesn't matter, as it's implicit.) I don't think there's much you can do if they have changed it.

I suggest looking at scripts that invoke Inkscape (summersnight.py, perspective.py, gimp_xcf.py, and maybe others), and see how they do things. (Best to look at the current versions in SVN rather than older versions.)

pelle
Posts: 53
Joined: Wed Mar 05, 2008 8:23 am

Re: bitmaps from python

Postby pelle » Sat Mar 08, 2008 7:50 am

Thank! I will have a look. I guess I could add the name of the command to invoke as a parameter if I want it to be easily configurable. But right now I will just invoke it by the name inkscape (only having a parameter to say what directory to put the output bitmaps in).


Return to “Help with using Inkscape”