Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

guides using gimp batch processing gimp-2.4.6 for slicing scanned photos

134 views
Skip to first unread message

Michael Ole Olsen

unread,
Sep 13, 2008, 3:47:04 PM9/13/08
to
michael@mws:~/.gimp-2.4/scripts% cat scanguides.scm
; uses guillotine on 4 scanned normal size photos to slice them out into
; 4 new images and save them
;
; use scanguides *.png 0 1 50 50
; filename guide directions and percents
; gimp -i -b '(scanguides "*.png" 0 1 50 50)' -b '(gimp-quit 0)'


(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.

Niels Giesen

unread,
Sep 26, 2008, 4:17:19 AM9/26/08
to

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.

0 new messages