From time to time I need to watermark some images. I find Patrick David's Simple Embossed Watermark in GIMP video (6:28 minutes) most valuable. In the video he adds some comments and background of what he accomplishes in each step. Which are worth understanding. Yet I had difficulties extracting just the raw instructions to apply for my images. Which is why I wrote this page.
Start by creating the text of the watermark.
Now add the watermark to the image. The next steps are with the image where the water mark is to be added.
Download create-wm.scm for the creation of the watermark. sha512sum is 9e4de39e2233309182d9faaab8eaf9f3445f3c11a144dc6efce0770b631c28a53c0e7cb26510cc7ff4df710766ec1b2437c7518476135897f0e35c7856e94280 .
; v2022-06-18, works with gimp 2.10.32
; Resources:
; https://www.youtube.com/watch?v=n4OBn5DJdjk
; https://docs.gimp.org/en/gimp-using-script-fu-tutorial.html
; https://www.seul.org/~grumbel/gimp/script-fu/script-fu-tut.html
;==================================================
;
; Installation:
; This script should be placed in the user or system-wide script folder.
;
; Windows 7/10
; C:\Program Files\GIMP 2\share\gimp\2.0\scripts
; or
; C:\Users\YOUR-NAME\AppData\Roaming\GIMP\2.10\scripts
;
;
; Linux
; /home/yourname/.config/GIMP/2.10/scripts
; or
; Linux system-wide
; /usr/share/gimp/2.0/scripts
;
;==================================================
;
; LICENSE
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see .
;
;==============================================================
(script-fu-register
"simple-embosed-water-mark-create" ;func name
"simple-embosed-water-mark-CREATE" ;func label
"Creates a simple water mark, to be embosed in other images. Its text is user choice.\nOne way to control the size of the watermark is by the font size.\nWatermarks created by this acript will be hardly, or not at all, observeable when embosed with the similar name -EMBOSE script to an area with little variation of color." ;description
"Ron Varburg" ;author
"copyright 2019-2022, Ron Varburg" ;copyright notice
"October 28, 2019" ;date created
"" ;image type that the script works on
SF-TEXT "Text" "© www.net9.cf" ;a string variable
SF-FONT "Font" "Sans" ;a font variable
SF-ADJUSTMENT "Font size" '(80 1 1000 1 10 0 1)
;a spin-button
SF-TOGGLE "Copy result to clipboard" TRUE
)
(script-fu-menu-register "simple-embosed-water-mark-create" "/File/Create/")
(define (simple-embosed-water-mark-create inText inFont inFontSize copyResultToClipboard)
(let*
(
; define our local variables
(imageWidth 10) ; will be adjusted later
(imageHeight 10) ; will be adjusted later
; create a new image:
(image (car (gimp-image-new
imageWidth
imageHeight
RGB
)
)
)
(textLayer1 (car (gimp-text-layer-new
image
inText
inFont
inFontSize
PIXELS
)
)
)
(textLayer2 -1)
(textLayer3 -1)
(topLayer -1)
(bufferAmount 0.1) ;0.1 for 10%
(bufferHeight -1)
(bufferWidth -1)
(mblurLength 3) ; value determined by trial and error
; an non essential layer that can help debugging:
(buttomLayer (car (gimp-layer-new
image
imageWidth
imageHeight
RGB-IMAGE
"buttom layer"
100
LAYER-MODE-NORMAL
)
)
)
) ; end of our local variables
(gimp-image-insert-layer image buttomLayer 0 0)
(gimp-context-set-background '(255 255 255) )
(gimp-context-set-foreground '(128 128 128) )
(gimp-drawable-fill buttomLayer BACKGROUND-FILL)
(gimp-item-set-visible buttomLayer FALSE)
(gimp-image-insert-layer image textLayer1 0 0)
(set! imageWidth (car (gimp-drawable-width textLayer1) ) )
(set! imageHeight (car (gimp-drawable-height textLayer1) ) )
(set! bufferHeight (* imageHeight bufferAmount) )
(set! imageHeight (+ imageHeight bufferHeight bufferHeight) )
(set! bufferWidth (* imageWidth bufferAmount) )
(set! imageWidth (+ imageWidth bufferWidth bufferWidth) )
(gimp-image-resize image imageWidth imageHeight 0 0)
(gimp-layer-resize buttomLayer imageWidth imageHeight 0 0)
(gimp-layer-set-offsets textLayer1 bufferWidth bufferHeight)
(set! textLayer2 (car (gimp-layer-copy textLayer1 FALSE) ) )
(gimp-image-insert-layer image textLayer2 0 0)
;(gimp-image-set-active-layer image textLayer1)
(gimp-drawable-levels textLayer1
HISTOGRAM-VALUE
0 1
FALSE
1.0
1 1
FALSE
)
(plug-in-mblur RUN-NONINTERACTIVE
image
textLayer1
0
mblurLength
45 ;45 degrees. An arbitrary value.
(/ imageWidth 2)
(/ imageHeight 2)
)
(gimp-layer-set-offsets textLayer1 (* bufferWidth 0.993) (* bufferHeight 0.993) )
; 0.993 for small, <1, still arbitrary, motion
(set! textLayer3 (car (gimp-layer-copy textLayer1 FALSE) ) )
(gimp-image-insert-layer image textLayer3 0 0)
(gimp-image-lower-item image textLayer3)
(gimp-drawable-levels textLayer3
HISTOGRAM-VALUE
0 1
FALSE
1.0
0 0
FALSE
)
(gimp-layer-set-offsets textLayer3 (* bufferWidth 1.008) (* bufferHeight 1.008) )
; 1.008 for small, >1, still arbitrary, motion
(set! topLayer (car (gimp-layer-new-from-visible image image "visible") ) )
(gimp-image-insert-layer image topLayer 0 0)
(gimp-display-new image)
;(gimp-image-clean-all image) ; Do ask whether or not to discard
; changes that were not saved when closing.
(if copyResultToClipboard (gimp-edit-copy-visible image) 0)
(list image topLayer) ; Return value of this script
)
)
Download embose-wm.scm for the addition of the watermark to the image. The image where the water mark is to be added is expected to be opened. sha512sum is 8eeb40a3fc0363eaed852b7903b08370943e8572a09de342a186c327782bd0c31b87fe87d5bbaf56db959c3451990e53f6efbf26f27ca9b368f5e081d912ae3d .
; v2022-06-18, works with gimp 2.10.32
; Resources:
; create-wm.scm
; https://pastebin.com/fKUxE8Ag
;==================================================
;
; Installation:
; This script should be placed in the user or system-wide script folder.
;
; Windows 7/10
; C:\Program Files\GIMP 2\share\gimp\2.0\scripts
; or
; C:\Users\YOUR-NAME\AppData\Roaming\GIMP\2.10\scripts
;
;
; Linux
; /home/yourname/.config/GIMP/2.10/scripts
; or
; Linux system-wide
; /usr/share/gimp/2.0/scripts
;
;==================================================
;
; LICENSE
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see .
;
;==============================================================
(script-fu-register
"simple-embosed-water-mark-embose" ;func name
"simple-embosed-water-mark-EMBOSE" ;func label
"Embose a simple water mark, previously created by the similar named -CREATE script.\nThe water mark is looked for in the clipboard. When the -CREATE script did not copy it there, the user is expected to:\n1) Copy the water mark to the clip board, possibly by Select -> All (Ctrl+A) followed by Edit -> Copy (Ctrl+C)\n2) Clicked on an opened image, or open it, right before activating this script.\n3) Activate the script. Set the sliders to 0 to get the watermark at the center of the image.\nThe script will clear the current selection for the image, if there is one.\nIt will not work on indexed type images.\nA watermark created by the similar name -CREATE script will be hardly, or not at all, observeable on an area that has no variation of color."
;description
"Ron Varburg" ;author
"copyright 2019-2022, Ron Varburg" ;copyright notice
"October 28, 2019" ;date created
"RGB | RGBA | GRAY | GRAYA" ;image type that the script works on
SF-IMAGE "Input Image" 0
SF-DRAWABLE "Input Drawable" 0
SF-ADJUSTMENT "Desired Horizontal Location of watermark upper\nleft corner. Negative numbers set it to the left (%)" '(0 -50 +50 1 5 0 0)
; horizontal location of the mark.
; Specified as precentage of image width
SF-ADJUSTMENT "Desired Vertical Location of watermark upper\nleft corner. Negative numbers set it upper (%)" '(0 -50 +50 1 5 0 0)
; vertical location of the mark.
; Specified as precentage of image height
)
(script-fu-menu-register "simple-embosed-water-mark-embose" "/Script-Fu")
(define (simple-embosed-water-mark-embose inImg inDrawable inHorizontalLocation inVerticalLocation)
(if (= (car (gimp-image-is-valid inImg)) FALSE)
(
(gimp-message "No valid image was marked, or otherwise given, to operate on. Quiting.")
(quit)
)
)
(if (= (car (gimp-edit-paste-as-new-image)) -1)
(
(gimp-message "Watermark was not copied to the clipboard. Quiting.")
(quit)
)
)
(if (= TRUE (car (gimp-layer-is-floating-sel
(car (gimp-image-get-active-layer inImg)))))
(
(gimp-message "The script doesn't work with floating selections. Quiting.")
(quit)
)
)
(gimp-image-undo-group-start inImg)
(let*
(
(horLoc (* (car (gimp-image-width inImg)) (/ inHorizontalLocation 100) ) )
(verLoc (* (car (gimp-image-height inImg)) (/ inVerticalLocation 100) ) )
(watermarkLayer1 (car (gimp-edit-paste inDrawable TRUE) ) )
; watermarkLayer1 is actualy a floating selection at this point. This will be adjusted later.
(watermarkLayer2 -1)
) ;end of our local variables
(gimp-item-transform-translate watermarkLayer1 horLoc verLoc)
(gimp-floating-sel-to-layer watermarkLayer1)
; floating selection became the active layer.
(gimp-layer-set-mode watermarkLayer1 LAYER-MODE-OVERLAY)
(set! watermarkLayer2 (car (gimp-layer-copy watermarkLayer1 FALSE) ) )
(gimp-image-insert-layer inImg watermarkLayer2 0 0)
(gimp-displays-flush)
;Finish the undo group for the process
(gimp-image-undo-group-end inImg)
(list watermarkLayer1)
) ;end let
)