You are here

batch to run FU-quick-sketch

Help me please , I'm very rookie
I use GIPM 2.8 on windoz7 64bit

i need to create a batch file to automize an effect on a large number of pics
but I can't find the right sintax; i receive always "invalid argument"

my go.bat file is:
"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -n -i -b '(FU-quick-sketch \"HS01568.jpg\" "HS01568.jpg" 30)' '(gimp-quit 0)'

the script is locate in:
C:\Program Files\GIMP 2\share\gimp\2.0\scripts\FU_sketch_quick-sketch.scm
(it work fine in GIPM in interactive mode)

script content is:
£££££££££££££££££££££££££££££££££££££££££££££££££££
(define (FU-quick-sketch theImage
theLayer
blurAmount
)

;Initiate some variables
(let* (
(layerCopy 0)
(layerGrey (car (gimp-drawable-is-gray theLayer)))
)

;Start an undo group so the process can be undone with one undo
(gimp-image-undo-group-start theImage)

;Rename the layer
(gimp-item-set-name theLayer "Original")

;Select none
(gimp-selection-none theImage)

;Change the layer Greyscale if it isn't already
(if (= layerGrey 0) (gimp-desaturate theLayer))

(set! layerCopy (car (gimp-layer-copy theLayer 1)))

;Copy the layer
(gimp-image-insert-layer theImage layerCopy 0 0)

;Rename the layer
(gimp-item-set-name layerCopy "Dodge layer")

;Invert the layer
(gimp-invert layerCopy)

;Change the layers mode
(gimp-layer-set-mode layerCopy 16)

;Blur the dodge layer
(plug-in-gauss 1 theImage layerCopy blurAmount blurAmount 0)

;Finish the undo group for the process
(gimp-image-undo-group-end theImage)

;Ensure the updated image is displayed now
(gimp-displays-flush)

)
)

(script-fu-register "FU-quick-sketch"
"Quick sketch"
"Create a sketch from a photo"
"Harry Phillips"
"Harry Phillips"
"Sep. 9 2007"
"RGB* GRAY*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Blur factor" '(30 5 200 1 1 0 1)
)

(script-fu-menu-register "FU-quick-sketch" "/Script-Fu/Sketch/")

£££££££££££££££££££££££££££££££££££££££££££££££££££

I've not looked at the details of your script as you say it works interactively but I can see something wrong with your batch file.

Windows/DOS doesn't use the single quote mark in the same way as Linux and you've forgotten a -b for gimp-quit, so try this:

"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -n -i -b "(FU-quick-sketch \"HS01568.jpg\" "HS01568.jpg" 30)" -b "(gimp-quit 0)"

That said, I've noticed that your script can't work anyway as it expects to get a layer id NUMBER, not a file name STRING. This is a common mistake:
http://gimpforums.com/thread-a-script-fu-rounded-corners-from-the-comman...

Kevin

txs for the reply
the script in interactive mode work fine

using your sintax the error is:
batch command experienced an execution error:

Error: ( : 1) eval: unbound variable: HS01568.jpg

(Type any character to close this window)

(now I feel near the solution) ;-)

using a number..
"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -i -b "(FU-quick-sketch \"HS01568.jpg\" 1 30)" -b "(gimp-quit 0)"

the error is..
GIMP-Error: Calling error for procedure 'gimp-drawable-is-gray':
Procedure 'gimp-drawable-is-gray' has been called with an invalid ID for argumen
t 'drawable'. Most likely a plug-in is trying to work on a layer that doesn't ex
ist any longer.

batch command experienced an execution error:
Error: ( : 1) Procedure execution of gimp-drawable-is-gray failed on invalid inp
ut arguments: Procedure 'gimp-drawable-is-gray' has been called with an invalid
ID for argument 'drawable'. Most likely a plug-in is trying to work on a layer t
hat doesn't exist any longer.

aaaahh

Both theImage and theDrawable in your procedure's signature are expected to be integer IDs of a loaded image and a drawable thereof.

See http://www.gimp.org/tutorials/Basic_Batch/ for an example of how to wrap a procedure into code that loads and processes image files one by one.

how can I get IDs of a loaded image?

This is what the (let* ...) Block in the Basic Batch example does - it assigns the IDs of the loaded image and the active drawable of that image to the variables image and drawable, respectively.

Subscribe to Comments for "batch to run FU-quick-sketch"