Fence you should get some pay out of this..
I absolutely agree with you. Fence, once the script is ready to be released, feel free to drop some suggestions via PM for a possible favour in return.
No worries. I like to help and this has been a good learning process for me. I even found out that the two Windows machines I'm working on don't respond to the script the same. One won't even recognize file directories, while the other will. So, to keep things simple, I'm sticking to the one that does. At any rate, don't want to turn this into a Windows gripe session.....
The code for the first test is included below. I decided against the bump map preview that I previously discussed because there would need to be some extra coding I didn't account for in my response. It's not too difficult, but it really makes the script unnecessarily cluttered.
Here's my suggestion as how to work around the preview issue: The basic concept for the script uses a pre-made pattern called "Watermark". You can use any other pattern, but the script looks for the "Watermark" as the default. So, create and save a "Watermark" pattern (needs to be spelled exactly as I have shown, without the quote marks). I can change all defaults later, but this is how the test works. For a preview, on a test image, add a new, transparent layer above the image (make the transparent layer the same size as your pattern) and fill the transparent layer with the pattern. Then, make your image layer active and manually run the bump map filter to see what looks good to you. Write down your settings and then run the script and substitute the defaults with your settings. I know this is not as convenient, but it works. Also, if you find that you're using certain bump map settings more than the defaults, I can modify the script so that your settings become the defaults.
This test will let you specify the folder to load the pictures from, identify the watermark pattern to be used (again, it can be any pattern, but for the time being, you need a default "Watermark" pattern), the location of the pattern (upper left/right, center, lower left/right), its color/opacity, bump map settings, where to save the pictures to and the new name of the pictures. I've tested it on various image sizes and it appears to work. I will let you know that the default settings don't look that great because the default opacity of 100 kinda hides the watermark. But, again, everything is pretty much open for modification. Once we know this works, adding the hidden watermark will be a piece of cake.
Lastly, should the script always perform the bump map/hidden watermark steps or should there be the option to choose? I can code that in with no problem.....just a thought.
Copy/paste the code into a new text document and save it to your GIMP scripts folder with an ".scm" extension. Refresh your scripts and, for the time being, the script is found under File > Watermark... (if you have other suggestions where this should be placed in the menus, please advise). Because I've removed the option for the preview, you no longer need an open image to run the script.
(define (fp-script-fu-watermark load pattern position color opacity azimuth elevation depth waterlevel ambient compensate invert type location filename )
(let* (
(filelist (cadr (file-glob (string-append load "\\*" ".jpg") 1)))
(s 1)
(count (car (file-glob (string-append load "\\*" ".jpg") 1)))
(drawable 0)
(patWidth (car (gimp-pattern-get-info pattern)))
(patHeight (cadr (gimp-pattern-get-info pattern)))
(patLayer 0)
(active 0)
(bumpLayer 0)
(filename2 0)
(offsetX 0)
(offsetY 0)
(imageWidth 0)
(imageHeight 0)
)
(while (pair? filelist)
(let* (
(loadfile (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE loadfile loadfile)))
)
;(gimp-display-new image)
(set! imageWidth (car (gimp-image-width image)))
(set! imageHeight (car (gimp-image-height image)))
(cond
( (= position 1) ; top right
(set! offsetX (- imageWidth patWidth))
)
( (= position 2) ; center
(set! offsetX (- (/ imageWidth 2) (/ patWidth 2)))
(set! offsetY (- (/ imageHeight 2) (/ patHeight 2)))
)
( (= position 3) ; bottom left
(set! offsetY (- imageHeight patHeight))
)
( (= position 4) ; bottom right
(set! offsetX (- imageWidth patWidth))
(set! offsetY (- imageHeight patHeight))
)
)
(set! patLayer (car (gimp-layer-new image patWidth patHeight RGBA-IMAGE "Pattern Layer" opacity NORMAL-MODE)))
(set! bumpLayer (car (gimp-image-get-active-layer image)))
(gimp-drawable-fill patLayer TRANSPARENT-FILL)
(gimp-drawable-fill patLayer PATTERN-FILL)
(gimp-image-add-layer image patLayer -1)
(gimp-layer-set-offsets patLayer offsetX offsetY)
(gimp-layer-set-lock-alpha patLayer TRUE)
(gimp-context-set-foreground color)
(gimp-edit-fill patLayer FOREGROUND-FILL)
(gimp-displays-flush)
(gimp-layer-resize-to-image-size patLayer)
(plug-in-bump-map RUN-NONINTERACTIVE image bumpLayer patLayer azimuth elevation depth 0 0 waterlevel ambient compensate invert type)
(set! active (car (gimp-image-flatten image)))
(gimp-displays-flush)
(set! filename2 (string-append location "/" filename (string-append (number->string s))".jpg"))
(gimp-file-save RUN-NONINTERACTIVE image active filename2 filename2)
(set! s (+ s 1))
;(gimp-image-delete (car newimage))
(set! count (- count 1))
(set! filelist (cdr filelist))
))
)
)
(script-fu-register "fp-script-fu-watermark"
"<Image>/File/Watermark..."
"Adds a bump mapped watermark to a folder of jpg images."
"Art Wade"
"Art Wade"
"March 2010"
""
SF-DIRNAME "Load pictures from" ""
SF-PATTERN "Pattern to use as bump map watermark" "Watermark"
SF-OPTION "Watermark position" '("Upper Left" "Upper Right" "Center" "Lower Left" "Lower Right")
SF-COLOR "Watermark color" '(255 255 255)
SF-ADJUSTMENT "Watermark opacity" '(100.0 0.0 100.0 1 10 1 0)
SF-ADJUSTMENT "Bump map azimuth" '(50.0 0.0 360.0 1 10 1 0)
SF-ADJUSTMENT "Bump map elevation" '(45.0 0.5 90.0 1 10 1 0)
SF-ADJUSTMENT "Bump map depth" '(2 1 65 1 10 0 0)
SF-ADJUSTMENT "Bump map waterlevel" '(0 0 255 1 10 0 0)
SF-ADJUSTMENT "Bump map ambient" '(0 0 255 1 10 0 0)
SF-TOGGLE "Bump map compensate for darkening" TRUE
SF-TOGGLE "Bump map invert" FALSE
SF-OPTION "Bump map type" '("LINEAR" "SPHERICAL" "SINUSOIDAL")
SF-DIRNAME "Save pictures to" "Save To"
SF-STRING "Name for watermarked images" "filename"
)