views:

78

answers:

2

I have a large SVG file (approx. 60 MB, 10000x10000 pixels but with the potential to get much larger), and I'm wanting to create, say, many tiled 256x256 PNG images from it (in that example there would be 1600 images; round(10000/256)^2).

Does anyone have any idea of how to do this on a web server (running PHP amongst other things)? I thought about rsvg, but it doesn't seem to have any functionality to modify the bounding box (and I'd rather avoid doing it manually for each section). ImageMagick might be able to do it, but I've not been having much luck with getting it to work. Using rsvg to create a large PNG and then using a tool dedicated to tiling very large images might work, but I've not had any luck finding such a thing! Speed isn't really an issue, although it is desirable, so if the worst comes to the worst, I might look into modifying the SVG's bounding box per section. I could see the generation taking forever, though!

Anyone know of any methods to do this?

A: 

I'd look at Apache Batik. In particular, their SVG Rasterizer looks like just what you need.

I've never used it for giant SVG files, though, so I don't know if it's optimized for that case or not.

Ken
Thanks for the suggestion, but I get an unhelpful "Loading document failed." when using it! I'll investigate, but it looks to be running out of memory, unfortunately.
Robert
+1  A: 

inkscape has a command line mode to export pngs, taking an optional argument to choose which area to export

inkscape vector.svg --export-png=raster.png --export-area=0:0:100:100
second