I've found three things wrong, all due to the same error:
The line that reads:
Code:
(pathpattern (string-append srcpath filepattern))
Should be:
Code:
(pathpattern (string-append srcpath DIR-SEPARATOR filepattern))
The line that reads:
Code:
(dirs (strbreakup filename "/"))
Should be:
Code:
(dirs (strbreakup filename DIR-SEPARATOR))
And the line that reads:
Code:
(destfilename (string-append destpath shortfilename))
should read:
Code:
(destfilename (string-append destpath DIR-SEPARATOR shortfilename))
Code:
(define (script-fu-watermark-batch
srcpath destpath wmfile xmargini ymargini opai wmtext xmargint ymargint opat opatb wmfont wmfontsize wmfontcolor wmnocolor wmemboss toplef toprig botlef botrig centered)
(let*
(
(flatten 1)
(filepattern "*.jpg")
(pathpattern (string-append srcpath DIR-SEPARATOR filepattern))
(filelist (cadr (file-glob pathpattern 1)))
)
(while (not (null? filelist))
(let*
(
(filename (car filelist))
(dirs (strbreakup filename DIR-SEPARATOR))
(depthofpath (length dirs))
(shortfilename (nth (- depthofpath 1) dirs))
(destfilename (string-append destpath DIR-SEPARATOR shortfilename))
(imagelist (gimp-file-load RUN-NONINTERACTIVE filename filename))
(image (if (not (null? imagelist)) (car imagelist) 0))
(drawablelist (gimp-image-get-active-layer image))
(drawable (if (not (null? drawablelist)) (car drawablelist) 0))
)
(if (> drawable 0)
(begin
(script-fu-watermark-it
image drawable wmfile xmargini ymargini opai wmtext xmargint ymargint opat opatb wmfont wmfontsize wmfontcolor wmnocolor wmemboss toplef toprig botlef botrig centered)
(set! drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image drawable destfilename shortfilename)
(gimp-image-delete image)
)
)
)
(set! filelist (cdr filelist))
)
)
)
And you probably want to change the line in the script-fu-register "script-fu-watermark-batch" that gives the location of the watermark image:
Code:
SF-FILENAME "Watermark image--------------" "/home/~username/Pictures/wm/c104.png"
because it
always throws an error when I run the script.
Kevin