On Fri, Dec 5, 2008 at 3:58 PM, bulia byak <buliabyak@...400...> wrote:
On Thu, Dec 4, 2008 at 10:33 PM, Alessandro Antonello
I can see that a problem in this script is that every time it calls a new instance of Inkscape. This is a problem. I read about the '--shell' command line option but seams to me that it is not working.
It works in the devel version. However, it only saves you time for starting up and shutting down Inkscape. If each slice is exported for a long time (if I understood you correctly) then this gain will be negligible. Its primary advantage is for exporting many fast and small files in succession.
I agree that overall, it is likely to be faster to export the entire file to bitmap, then slice the bitmap. However, I never tried to slice bitmaps this large either, so I don't know how fast it will be.
The need to slice raster images, (as well as raster images originating in vectors) crops up frequently enough that I decided to see what would take to write a small commandline tool using GEGL that loads the source image only once. For sources see:
http://svn.gnome.org/viewvc/gegl/trunk/examples/gegl-slicer.c?view=markup
A sample session of it in use:
pippin@...2099...:~/src/gegl/examples/test$ ls -R .: gegl.png out slice-list
./out: pippin@...2099...:~/src/gegl/examples/test$ cat slice-list # blank lines and lines and comments are ignored 291,486 100x120 foo.png 291,486 340x120 bar.png 8,611 650x50 baz.png pippin@...2099...:~/src/gegl/examples/test$ ../gegl-slicer gegl.png slice-list out/ out/foo.png (291,486 100x120) out/bar.png (291,486 340x120) out/baz.png (8,611 650x50) pippin@...2099...:~/src/gegl/examples/test$ ls -R .: gegl.png out slice-list
./out: bar.png baz.png foo.png pippin@...2099...:~/src/gegl/examples/test$
The task of repeatedly slicing images/compositions like this is something that occurs in workflows on both vector images and raster images, especially for web/GUI work. Editing a text file is not sufficient for most users though so tools (either in GIMP/inkscape) or stand-alone ones will be needed to streamline configuration of such automation.
It isn't as efficient in use probably as something that also has a GUI for specifying the different rectangular regions to be exported but it does do the job. It could probably have been written more neatly using Ruby or Python.
/Øyvind K.