Hi all,
Pretty new here, though I've been using inkscape for some time.
Recently I was looking for something to keep a "master image" of sorts for an entire chapter of say a book, and then be able to automatically export the pictures that make up that chapter as different formats. I couldn't find anything, well I found one thing that sort of worked, but was a hassle to use and only exported .png (although it was easily modded to allow for eps). So I wrote this small script which should be fairly self explanatory and posted it here.
I'm new to this whole thing though so I would love feedback, and also it may be useful to some of you.
Exporting specially named groups as multiple formats
-
- Posts: 4
- Joined: Fri Mar 15, 2013 1:06 am
Re: Exporting specially named groups as multiple formats
Hi nalaurethsulfate 
Interestingly there was a discussion on the developers list recently on this topic. Unfortunately it stranded in bickering about save v.s. export, but the basic idea that the current export to .png could easily be extended to all other formats supported by Inkscape stands vindicated by what you did I guess. If you be interested in extending your work so all exports could be handled by the same mechanism I am sure it would be a great improvement for Inkscape. I personally see any format that is not Inkscape native as an export, but better not mention that concept.. lol. Being able to export a group or selection or area to any given format would be a great tool and highly useful for everybody.
In any case I think you might want to discuss your script on the developers list for more insightful feedback. I personally like it a lot already, but would like to see it extended to more supportable formats.

Interestingly there was a discussion on the developers list recently on this topic. Unfortunately it stranded in bickering about save v.s. export, but the basic idea that the current export to .png could easily be extended to all other formats supported by Inkscape stands vindicated by what you did I guess. If you be interested in extending your work so all exports could be handled by the same mechanism I am sure it would be a great improvement for Inkscape. I personally see any format that is not Inkscape native as an export, but better not mention that concept.. lol. Being able to export a group or selection or area to any given format would be a great tool and highly useful for everybody.
In any case I think you might want to discuss your script on the developers list for more insightful feedback. I personally like it a lot already, but would like to see it extended to more supportable formats.
-
- Posts: 4
- Joined: Fri Mar 15, 2013 1:06 am
Re: Exporting specially named groups as multiple formats
Thanks Jelle!
I like your ideas and would love to start hacking away on inkscape itself, but unfortunately will not have the time to do so for at least the next month.
As far as more supportable formats, it is incredibly simple to extend to any that have the api call that respects "--export-id" and that has an --export-"type"="filename" in the API. I think this supports all of those formats, and certainly covers many bases. More formats might require more inkscape scripting, which sucks, and has to open the window every time (I did it for the plain svg export), but it really is terrible.
Anyways I will probably post this on the forums because the whole export vs. saving thing could probably use some more hashing out :s
I like your ideas and would love to start hacking away on inkscape itself, but unfortunately will not have the time to do so for at least the next month.
As far as more supportable formats, it is incredibly simple to extend to any that have the api call that respects "--export-id" and that has an --export-"type"="filename" in the API. I think this supports all of those formats, and certainly covers many bases. More formats might require more inkscape scripting, which sucks, and has to open the window every time (I did it for the plain svg export), but it really is terrible.
Anyways I will probably post this on the forums because the whole export vs. saving thing could probably use some more hashing out :s
Re: Exporting specially named groups as multiple formats
nalaurethsulfate wrote:Anyways I will probably post this on the forums because the whole export vs. saving thing could probably use some more hashing out :s
If you want to have this discussion with developers, this forum would probably not be the best place to do it, since not many devs participate here. Of course you're welcome to start such a discussion, but you probably won't get many devs' attention or participation here.

Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Exporting specially named groups as multiple formats
Hi nalaurethsulfate
Nice code!
Found I had to install lxml and svgfig to get it to work.
RGDS
Ragnar
Nice code!
Found I had to install lxml and svgfig to get it to work.
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
-
- Posts: 4
- Joined: Fri Mar 15, 2013 1:06 am
Re: Exporting specially named groups as multiple formats
Oh, I should have stated that in the readme
Re: Exporting specially named groups as multiple formats
Hi
I find that I have to close Inkscape manually every time it's opened by your script - is this intentional?
Inkscape also "complains" a lot about missing fonts when running your script - how can that be avoided?
RGDS
Ragnar
I find that I have to close Inkscape manually every time it's opened by your script - is this intentional?
Inkscape also "complains" a lot about missing fonts when running your script - how can that be avoided?
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
-
- Posts: 4
- Joined: Fri Mar 15, 2013 1:06 am
Re: Exporting specially named groups as multiple formats
On my computer it works as described, without having to manually close, and with no complaints about missing fonts.
Have you tried it with one of your own svg's? If that doesn't fix both problems try another script that just opens and closes inkscape, you should be able to hijack that code from my script easily.
Other than that I'm not sure what to tell you and don't have too much time to play with this for a while.
Have you tried it with one of your own svg's? If that doesn't fix both problems try another script that just opens and closes inkscape, you should be able to hijack that code from my script easily.
Other than that I'm not sure what to tell you and don't have too much time to play with this for a while.