Request: Add guillotine extension to trunk

Bug #618581 reported by Craig Marshall
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Unassigned

Bug Description

Newly written guillotine extension available here (mirrors the slicing abilities of GIMP's function of the same name):

http://www.craigmarshall.org/archives/8

License: GNU GPL2 or later

Revision history for this message
su_v (suv-lp) wrote :
tags: added: extensions-plugins
Changed in inkscape:
importance: Undecided → Wishlist
Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

This extension is used for exporting png slices from a drawing. The slice rectangles are defined by adding horizontal and vertical guides within the canvas boundary, the canvas boundary serves as the outside of the sliced area. You can specify the output directory name and image filename prefix in the extension dialog, or if you've previously exported the drawing, you can opt to use that information and it will use the export hints + a numerical suffix for each slice.

Revision history for this message
su_v (suv-lp) wrote :

Tested and confirmed with Inkscape 0.47, 0.48 and 0.48+devel r9714 on OS X 10.5.8 (with Python 2.5 and 2.6)

Changed in inkscape:
status: New → Confirmed
tags: added: exporting guides png
Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

It was developed and tested by me using Inkscape 0.47 on Windows 7 using Python 2.5.1 - if that helps at all.

Revision history for this message
jazzynico (jazzynico) wrote :

Thanks for this extension!

I've tried to run it on Windows XP, Inkscape 0.47 and trunk revision 9674, and nothing is exported (no error message).
"Directory to save" set to C:\ (also tried C:/) and "Image name" not changed.
SVG document attached.

There's a little bug that prevent the script from running when the document height and width elements have units (tested with the French default template).
Replacing (lines 126 and 142)
  height = root.attrib['height'] and width = iroot.attrib['width']
with
  height = inkex.unittouu(root.attrib['height']) and width = inkex.unittouu(root.attrib['width'])
seems to fix this issue.

Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

Okay - I've used your fix for the units problem. New attachment includes the fix.

Unsure about the problem saving to C:\, I'm on windows 7 and it's working here. Are you perhaps able to stick an inkex.errormsg or two in to see where it falls over?

If not, I might get a virtual machine set up later with XP to test this out.

Thanks

Revision history for this message
jazzynico (jazzynico) wrote :

Same issue on Ubuntu 10.04.

I thing this is a locale problem with decimal separators. My system LANG env is set to fr_FR.utf8.
I've tested this:

[19:19]:nicolas@hobbes:~$ inkscape -a 0:0:414.28571:371.42857 -e "/home/nicolas/Desktop/guillotined0.png" "/home/nicolas/Desktop/test.svg"
** (inkscape:15391): WARNING **: Cannot parse export area '0:0:414.28571:371.42857'; use 'x0:y0:x1:y1'. Nothing exported.

But it works fine if I use C locale:

[19:20]:nicolas@hobbes:~$ export LANG=C; inkscape -a 0:0:414.28571:371.42857 -e "/home/nicolas/Desktop/guillotined0.png" "/home/nicolas/Desktop/test.svg"
Background RRGGBBAA: ffffff00
Area 0:0:414.286:371.429 exported to 414 x 371 pixels (90 dpi)
Bitmap saved as: /home/nicolas/Desktop/guillotined0.png

Revision history for this message
jazzynico (jazzynico) wrote :

Attached is a modified version of the python script that should work with any locale.
Since Inkscape rounds the position values, I've kept the integer part of the float values.

(Please note that I'm not a Python expert and that there's probably an easier way to handle this case...)

Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

Thanks JazzyNico, that's great. I was just scratching my head for the last hour over how to do that (I've never done that kind of thing before). I should have checked my email for an update, and I'd have saved myself some time! Thanks again.

Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

I've started a project page where you can report bugs and always download the latest version (rather than abusing/littering a single bug thread by trying to do the whole thing here):

Download:
http://code.google.com/p/inkscape-guillotine/downloads/list
(The version 0.3 that's there at the moment is the same as the latest version available here, so there's no reason to download from there yet)

Main project page:
http://code.google.com/p/inkscape-guillotine

Revision history for this message
jazzynico (jazzynico) wrote :

Guillotine v0.3 committed in the trunk, revision 9725.
My main concern is its Export menu. I'm not sure it's the best place for this extension, but I see nowhere else (in the existing extensions menus) where it could fit.

Changed in inkscape:
milestone: none → 0.49
status: Confirmed → In Progress
assignee: nobody → Craig Marshall (craig9)
Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

That is great - thanks very much.

Changed in inkscape:
status: In Progress → Fix Committed
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.