Guillotine batch script
Hello I've searched far and wide and seen some questions on this, but no answers I could make use of. One link here: http://groups.google.tt/group/comp.graphics.apps.gimp/browse_thread/thread/f46cc17a1874caea has an answer that I don't know enough scheme to make use of.
Basically I want to input based on a file glob a filename such as 0001.jpg, add a vertical guide at a certain percentage, say 50%, and then guillotine it and save the resulting images as 0001a.jpg and 0001b.jpg
I started with the http://www.gimp.org/tutorials/Basic_Batch/ basic batch tutorial and tried to modify it for my needs, but without knowing scheme and not being able to figure out enough I didn't know how to assign the right image and drawable and save the resulting parts to the filenames I want.
Here is what I tried:
(define (batch-guillotine pattern direction percent)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-guide-new-percent 0 image drawable direction percent)
(plug-in-guillotine 0 image drawable)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
Can anyone finish it for me? I have gotten other single plugins to work in batch mode like this calling something like
$ gimp -i -b '(batch-guillotine "*.jpeg" 1 50)' -b '(gimp-quit 0)' , but nothing so complex as this one. I'm running Gimp 2.6.1 on Ubuntu 8.10 so if someone wrote a python script instead to do the same thing I could figure out how to run that if someone pointed me to the docs. Thanks
Taxman