; (define (script_fu_batchtest textStuff filename) ; Begin Script (let* ( ; Declare W/H vars & assign dummy val (imgWidth 1) (imgHeight 1) ; Declare and create the new image (img (car (gimp-image-new imgWidth imgHeight RGB))) ; Declare/create layers in the image: (bgLayer (car (gimp-layer-new img imgWidth imgHeight RGB_IMAGE "Background" 100 NORMAL ) ) ) (baseLayer (car (gimp-layer-new img imgWidth imgHeight RGB_IMAGE "Text Layer" 100 NORMAL) ) ) ; Keep the background colors (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background))) ) ; (End of "(let* ... (" ) ; Disable undo recording (gimp-image-undo-disable img) ; Add the layers to the image (gimp-image-add-layer img bgLayer 0) (gimp-image-add-layer img baseLayer 0) ; Set the fground and bground colors (gimp-palette-set-background '(255 255 255)) (gimp-palette-set-foreground '(0 0 0)) ; Clear the background layer (gimp-edit-clear bgLayer) ; Add alpha and clear the text layer (gimp-layer-add-alpha baseLayer) (gimp-edit-clear baseLayer) ; Create the new text layer (let* ( (floatText (car (gimp-text-fontname img baseLayer 0 0 textStuff 5 TRUE 24 PIXELS "-freefont-agate-normal-r-normal-*-24-*-*-*-p-*-*-*")) ) ) ; (End of nested "(let * ... (" ) ; Resize the Image to proper size (set! imgWidth (car (gimp-drawable-width floatText))) (set! imgHeight (car (gimp-drawable-height floatText))) (gimp-image-resize img imgWidth imgHeight 0 0) (gimp-layer-resize bgLayer imgWidth imgHeight 0 0) (gimp-layer-resize baseLayer imgWidth imgHeight 0 0) (gimp-floating-sel-anchor floatText) ) ; (End of nested "(let *" ) ; Flatten the Image (set! bgLayer (car (gimp-image-flatten img))) ; Autocrop (plug-in-autocrop FALSE img bgLayer) ; Clear the dirty count. (gimp-image-clean-all img) ; Add undo support again (gimp-image-undo-enable img) ; Reset the colors (gimp-palette-set-foreground old-fg) (gimp-palette-set-background old-bg) (gimp-display-new img) ; Save the new image (gimp-file-save 1 img bgLayer filename filename) ) ; (End of outer "(let *" ) ) ; Register script with the Gimp (script-fu-register "script_fu_batchtest" "/Xtns/Script-Fu/Misc/Batch Test" ; Menu location "SCRIPT NAME" "AUTHOR" "COPYRIGHT" "MODIFY DATE" "" ; Image types SF-STRING "Text" "Hello World" SF-STRING "Filename" "batch-test.jpg" )