summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 675610a)
raw | patch | inline | side by side (parent: 675610a)
author | acspike <acspike@users.sourceforge.net> | |
Mon, 11 Feb 2008 00:25:19 +0000 (00:25 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Mon, 11 Feb 2008 00:25:19 +0000 (00:25 +0000) |
I think this is a complete fix for the script but I can't tell because inkscape crashes.
Intercepting the temporary file the script creates I get a complete layered xcf!
Intercepting the temporary file the script creates I get a complete layered xcf!
share/extensions/gimp_xcf.py | patch | blob | history |
index b7f0ff78fa0aacb2b470ca3353ace93e11e07e03..7951ad1905309c2ab34b605a02144aa4e71f6808 100755 (executable)
path = "/svg:svg/*[name()='g' or @style][@id]"
for node in self.document.xpath(path,inkex.NSS):
id = node.get('id')
- inkex.debug(id)
name = "%s.png" % id
filename = os.path.join(tmp_dir, name)
command = "inkscape -i %s -j %s -e %s %s " % (id, area, filename, svg_file)
namelist = '"%s"' % '" "'.join(names)
xcf = os.path.join(tmp_dir, "%s.xcf" % docname)
script_fu = """
+(tracing 1)
(define
(png-to-layer img png_filename layer_name)
(let*
(img (car (gimp-image-new 200 200 RGB)))
)
(gimp-image-undo-disable img)
- (let* ((filelist '(%s))(namelist '(%s)))
- (while filelist
- (let* ((filename (car filelist))(layername (car namelist)))
- (png-to-layer img filename layername)
- )
- (set! filelist (cdr filelist))
- (set! namelist (cdr namelist))
+ (for-each
+ (lambda (names)
+ (png-to-layer img (car names) (cdr names))
)
+ (map cons '(%s) '(%s))
)
(gimp-image-resize-to-layers img)
(gimp-image-undo-enable img)
""" % (filelist, namelist, xcf, xcf)
junk = os.path.join(tmp_dir, 'junk_from_gimp.txt')
- f = os.popen('gimp -i -b - > %s' % junk,'w')
+ f = os.popen('gimp -i --batch-interpreter plug-in-script-fu-eval -b - > %s 2>&1' % junk,'w')
f.write(script_fu)
f.close()
-
+ # uncomment these lines to see the output from gimp
+ #err = open(junk, 'r')
+ #inkex.debug(err.read())
+ #err.close()
+
x = open(xcf, 'r')
sys.stdout.write(x.read())
x.close()