Exporting grid of images from Inkscape document

Discussion about writing code for Inkscape.
joneian
Posts: 2
Joined: Fri May 18, 2012 5:22 am

Exporting grid of images from Inkscape document

Postby joneian » Sat May 19, 2012 7:40 am

Hi,

Firstly thank you for Inkscape, its really very good - the best open source UI I've seen.

I have a very large (8300x11800, 5MB) map Inkscape document. I need to slice it up in to a grid of tile images for use in a google maps style web application. I need a grid of hundreds of 256x256 png tiles at various zoom levels. I'm trying to work out how/if I can do this in Inkscape. I'm a programmer, so open to scripting options.

My first thoughts were to use the Web Slicer. I could easily generate the SVG for the web slicer layer with a grid of squares, but the script plug in architecture means its unusably slow on my very large document. As I understand it (and I'm new to Inkscape so may be wrong) when I run the web slicer it does this:
  1. Save a temporary version of my document (slow for my large doc, but only happens once)
  2. Runs webslicer_export.py which
    1. Parses the temporary document to get all the elements in the web slicer layer (slow for my large doc, but only happens once)
    2. For each element call the inkscape executable to export the element (inkscape -i elem_id -e tile.png tmp.svg) - (slow for my large doc, and happens hundreds of times)

I can't see any way in a script extension or using the command line options that I can export multiple elements in one call to the executable (ie. one load of the document).

Any ideas?

Thanks,
Ian

ofnuts
Posts: 15
Joined: Mon May 07, 2012 6:49 am
Location: Lost in my thoughts

Re: Exporting grid of images from Inkscape document

Postby ofnuts » Sat May 19, 2012 6:44 pm

I wouldn't be using Inkscape for this. I would generate the big image at the various zoom levels (manually or with an Inkscape script if there are too many), and then split the PNG in tiles (with ImageMagick: http://imagemagick.org/Usage/crop/#crop_tile ).

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Exporting grid of images from Inkscape document

Postby brynn » Sun May 20, 2012 4:48 am

I don't understand much about what you're doing, but there are some extensions that sound pretty close to what you want. In this list: http://wiki.inkscape.org/wiki/index.php ... Repository.

It seems to me that there should be a way to script this, or maybe even use command line. But I couldn't tell you how. Someone may eventually reply here, but I'm thinking the IRC channel might be a faster way to helpful comments for your project. http://inkscape.org/discussion.php?lang=en

joneian
Posts: 2
Joined: Fri May 18, 2012 5:22 am

Re: Exporting grid of images from Inkscape document

Postby joneian » Sun May 20, 2012 7:55 am

ofnuts wrote:I would generate the big image at the various zoom levels (manually or with an Inkscape script if there are too many), and then split the PNG in tiles (with ImageMagick: http://imagemagick.org/Usage/crop/#crop_tile ).


Thanks. I had the same idea, although I didn't know ImageMagick did the tiling out if the box - that's really helpful thanks!

My problem is that my big image is so big that nothing can load it.

So I guess my best approach use web slicer to slice my map into 4 big tiles, then split those up using ImageMagick to split those into my small 256x256 tiles. I could script that up easily enough.

I shall give that a try - Thanks!
Ian

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Exporting grid of images from Inkscape document

Postby brynn » Wed Nov 28, 2018 3:16 pm

Unfortunately, I can't figure out if you're asking us a question, or suggesting an answer to the older topic. Either way, you'll probably need to elaborate.


Return to “Programming”