Hi all,
Now that 0.42 is done, I thought I'd send the extension version of svgslice for others to test and consider for inclusion.
It's pretty basic: just saves marked sections of the image into separate PNG "slices", and generates a basic XHTML file that lists the slices. Most notably, no equivalent layout is done in the XHTML file, so that it looks like the original SVG drawing. Problem is, there are many ways to do that in CSS, and the most obvious way (absolute positioning) is probably not much use to people. I suspect it would lead to bad web pages, or just get in the way of proper hand-crafted layout, and people who want to use a WYSIWYG CSS editor to move them around easily can still do so.
Note also, that the slices will be saved in Inkscape's current directory. If you load inkscape by double-clicking on an image in a project folder, and save the XHTML file in the same folder, then this is fine -- your startup directory will be that folder, and images will be right alongside the XHTML file.
But if you start inkscape from your home directory on the command line, or from just running it via a menu entry, and then load and save a file in another location, the PNG slices will end up in your home directory (at least on unix; windows might save then in C: or "C:\Program Files\Inkscape", or something like that.
At the moment, there's nothing I can do about that, since inkscape doesn't CD to the output directory before calling the extension, and doesn't seem to provide the extension with any idea of where it is actually saving stuff.
Personally, I'd like to see that issue fixed for 0.43.
But either way, it'll be good to hear if this works for others, if there are any bugs, etc. So please give it a test, and let me know :)
Installation ============ Save both attached files in your inkscape extensions directory. If that directory is somewhere other than /usr/share/inkscape/extensions, then you'll need to edit the paths in svgslice.inx to reflect that.
Obviously, this will have a different path on Windows. Maybe someone could edit the svgslice.inx file, and post it here for other windows users?
Usage =====
* Draw something.
* Create a layer called "slices".
* Draw rectangles in this layer representing the areas you want to slice (note: it helps if you make the rectangles semi-transparent)
* Optionally, name any/all slices by using the built-in XML editor to edit the "id" attributes of the rectangles.
* Hide the slices layer.
* Choose "Save as..." from the File menu.
* Select "XHTML file with PNG slices" as the file type to use.
* Enter a filename (e.g., "test.xhtml"), and save.
Result ====== * You should have the test.xhtml file on your disk, alongside the PNG slices for each area of the drawing that you made a rectangle for.