(define (scanguides filename direction1 direction2 percent1 percent2)
(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 direction1 percent1)
(script-fu-guide-new-percent 0 image drawable direction2 percent2)
(plug-in-guillotine 0 image drawable)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
(set! filelist (cdr filelist))))
any idea what is wrong with this script?
it should save 4 slices in 4 different files after run.
i just get an "unexpected error" message when running with the above command.
Hi Michael,
Yes, I know what is wrong:
plug-in-guillotine makes four new images in this case, gives (#t) as
return value, so you will have to find the integers referring to the
new images yourself (if the original image had int 3, your four new
images should have ints 4,5,6 and 7 right after creation). Not nice to
have to rely on these internals, but so be it.
Either that, or loop through the vector returned by (gimp-image-list),
skipping the original image.
Get their filenames with (gimp-image-get-filename int) to pass on to
gimp-file-save. And note that you will have to get the active drawable
for each image separately.