Free GIMP Batch Image Watermark Script

I use GIMP. It does the job quite well for most things but I felt a bit robbed (of my $0) when I found out there was no watermark tool, especially one that works in bulk. After trying to search around I did find a watermark python script that worked on basic terms at the Gimp Plugin Registry. However I believe it was limited to text and had some features I really wanted.

I decided to try to learn ‘script-fu’. I’ve got to say it was the roughest coding experience I’ve had in awhile. Even the GIMP batch tutorial leaves a lot to be explained, and it didn’t even work for me without trial and error on the batch command! Don’t get me started on how the code was laid out.

Regardless, you’re likely here just to get what you need done. Lets start.

  1. Download my script, here’s a link.
  2. Save this file to your GIMP install followed by \share\gimp\2.0\scripts. GIMP is often found under Program Files (for those Windows users like me). While you’re there, why not open up the file and take a look at my hard work and imagine the alcohol needed to fuel that.
  3. I did not put time into writing a fancy interface. This script is best run from command line. For Windows users Start -> Run… -> Cmd (hit OK) will do the trick.
  4. Type cd followed by your GIMP directory (i.e. cd “C:\Program Files\GIMP 2\bin”)

OK take a break for one second and see what my command lets you define:

Watermark Path – Path to a watermark in XCF (GIMP) format. Other formats may work as well.
Input files – Path to directory, followed by a wildcard search (i.e. *.jpg to target all jpg images to be watermarked).
Watermark Size – How big your watermark will be in accordance to the image. This is a percent but is entered as a decimal such as .05 (5%).
Watermark Padding – Each watermark will be padded from the corners of the image by a percentage (of the entire image) you define. This is a percent but is entered as a decimal as well.
Watermark Layer Mode – leave this as 0 (zero). higher numbers (i.e. 1,2,3…) will enable a different layer mode such as lighten/hard light/etc.
Position Number – My script allows for the watermark to be aligned in any corner, or the center. Acceptable values are 1,2,3,4,5.
Output Path – Where the watermarked images will be saved to.

Important notes:

  • Any paths defined should be enclosed in quotes. These quotes should be preceded by a backslash with no space. I.e. C:\Mike in the script would become \”c:\\mike\”. Any other backslashes MUST ALSO be preceded by a backslash (as seen between c: and mike).
  • Output path must be a directory. Do not leave a trailing slash on this.

So. You want to run THIS!

gimp-2.8.exe -b "(migee-add-watermark watermark-path inputfiles watermark-size watermark-padding watermark-layer-mode position output-dir)"

By example:

This is what I had to do to run my script on a folder WatermarkTest in my desktop on every JPG, having the watermark sized 25% and padded 1% along with a layer effect (15) and centered (5). Outputted files went to the same directory (the script prefixes all file names).

gimp-2.8.exe -b "(migee-add-watermark \"C:\\Users\\Migee\\Desktop\\WatermarkTest\\watermark.xcf\" \"C:\\Users\\Migee\\Desktop\\WatermarkTest\\*.jpg\" .25 .01 15 5 \"C:\\Users\\Migee\\Desktop\\WatermarkTest\")"

Final Notes:

Windows users, typing these the commands into a text file with the extension .BAT will save time if you do this a lot. It’s not easy with all the double slashes and slashed file location quotes.

This has HARDLY been tested and was really just completed to see if I could do this or not. I did little testing aside from the few images and singular watermark I’ve been working with. Please post up any problems and I can see if I can make this script work better!

10 Responses to “Free GIMP Batch Image Watermark Script”

  1. Roman says:

    Great thanks man! Works fine! You make world better! Script saves time and money!

  2. Diego Garcia says:

    I got an error after the weekend with the script in the funcion gimp-file-saved. Does anyone know why can be?

  3. Robert says:

    I’ve been looking for this script for years but never knew it! Thank you so much for this, man. I’m going to use it All. The. Time.

  4. Mark Davis says:

    Just watermarked hundreds of pictures on my wife’s jewelry web site in just a few minutes. Would’ve taken me a week or more w/o this. Thank you, thank you.

  5. Urs says:

    Great Tool! I’m really not a geek, but I manged it with your help! Great work!

  6. Claudio says:

    Hi Mike,
    Great script, thank you. One thing I noticed is that, even adding a small (3KB) .XCF watermark to a 220KB JPEG file, the file size increases by more than 100KB. Is this something you were aware of?

  7. Skolman says:

    This don’t work with gimp 2-6 ….but on 2-8 super . My images are bigger of 20kb only

  8. lolo says:

    How to use it? I’ve done as you’ve written… Gimp2 has started… when can I do it?

  9. Dao Ngoc Hoang says:

    Hi every one, I wonder if this command may be “watermark-path” as “text-watermark”:
    gimp-2.8.exe -b “(migee-add-watermark watermark-path inputfiles watermark-size watermark-padding watermark-layer-mode position output-dir)”

    For excame: I want to watermark my image.png with text “hello-world”

  10. Alexandre Vianna says:

    Hi!

    I’ve been looking for this for long time, and from the feedbacks it seems to work like a breeze, but for me it isn’t.

    I have defined:

    Script folder: C:\Program Files\GIMP 2\share\gimp\2.0\scripts\migee.scm

    Original pictures folder: C:\Photos\Orig

    Watermarked pictures folder: C:\Photos\Watermarked

    Watermark file patch: C:\Photos\wm2013amM.xcf

    Gimp 2.8 folder: “C:\Program Files\GIMP 2\bin\gimp-2.8.exe”

    Command line used:

    “c:\Program Files\GIMP 2\bin\gimp-2.8.exe” -b “(migee-add-watermark \”c:\\Photos\\wm2013amM.xcf\” \”c:\\Photos\Orig\\*.jpg\” .05 .01 0 4 \”c:\\Photos\\Watermarked\”)”
    “C:\Program Files\GIMP 2\bin\gimp-2.8.exe” -b “(migee “C:\Photos\wm2013amM.xcf\” “C:\Photos\Orig\*.jpg” .06 .0 .0 4 “C:\Photos\Watermarked\”)”

    In the end it shows a prompt screen saying “batch command executed successfully”, but nothing happens. The screen keeps on forever if I do nothing. Then I closed the window and ran the script on verbose mode, with this command line:

    “c:\Program Files\GIMP 2\bin\gimp-2.8.exe” –verbose -b “(migee-add-watermark \”c:\\Photos\\wm2013amM.xcf\” \”c:\\Photos\Orig\\*.jpg\” .05 .01 0 4 \”c:\\Photos\\Watermarked\”)”

    I will post below the full log, but the last tools called my attention:

    loading menu ‘c:\Program Files\GIMP 2\share\gimp\2.0\menus\image-menu.xml’ for /image-menubar
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-lcms.dll’
    No batch interpreter specified, using the default ‘plug-in-script-fu-eval’.
    batch command executed successfully

    What that means?

    Can someone help me to clarify this?

    Full log below:

    INIT: gimp_load_config
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\unitrc’
    Parsing ‘c:\Program Files\GIMP 2\etc\gimp\2.0\gimprc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\gimprc’
    gimp_composite: verbose=no
    Processor instruction sets: +mmx +sse +sse2 -3dnow -altivec -vis
    Adding theme ‘Default’ (c:\Program Files\GIMP 2\share\gimp\2.0\themes\Default)
    Adding theme ‘Small’ (c:\Program Files\GIMP 2\share\gimp\2.0\themes\Small)
    Writing ‘C:\Users\Alexandre\.gimp-2.8\themerc’
    Trying splash ‘C:\Users\Alexandre\.gimp-2.8\gimp-splash.png’ … failed
    Trying splash ‘c:\Program Files\GIMP 2\share\gimp\2.0\images\gimp-splash.png’ ..
    . OK
    INIT: gimp_initialize
    INIT: gimp_real_initialize
    INIT: gui_initialize_after_callback
    INIT: gimp_restore
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\parasiterc’
    Loading ‘brush factory’ data
    Loading ‘dynamics factory’ data
    Loading ‘pattern factory’ data
    Loading ‘palette factory’ data
    Loading ‘gradient factory’ data
    Loading fonts
    Loading ‘tool preset factory’ data
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\templaterc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\modulerc’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-cmyk.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-cmyk.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-water.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-water.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-wheel.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcolor-selector-wheel.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcontroller-dx-dinput.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libcontroller-dx-dinput.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-color-blind.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-color-blind.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-gamma.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-gamma.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-high-contrast.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-high-contrast.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-lcms.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-lcms.dll’
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-proof.dll’
    Unloading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-proof.dll’
    INIT: gui_restore_callback
    clipboard: writable pixbuf format: image/png
    clipboard: writable pixbuf format: image/bmp
    clipboard: writable pixbuf format: image/x-bmp
    clipboard: writable pixbuf format: image/x-MS-bmp
    clipboard: writable pixbuf format: image/x-icon
    clipboard: writable pixbuf format: image/x-ico
    clipboard: writable pixbuf format: image/x-win-bitmap
    clipboard: writable pixbuf format: image/tiff
    clipboard: writable pixbuf format: image/jpeg
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\sessionrc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\dockrc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\toolrc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\contextrc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-rect-select-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-ellipse-select-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-free-select-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-fuzzy-select-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-by-color-select-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-iscissors-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-foreground-select-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-vector-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-color-picker-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-zoom-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-measure-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-move-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-align-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-crop-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-rotate-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-scale-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-shear-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-perspective-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-flip-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-cage-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-text-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-bucket-fill-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-blend-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-pencil-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-paintbrush-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-eraser-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-airbrush-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-ink-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-clone-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-heal-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-perspective-clone-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-convolve-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-smudge-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-dodge-burn-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-desaturate-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-color-balance-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-hue-saturation-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-colorize-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-brightness-contrast-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-threshold-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-levels-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-curves-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-posterize-tool’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\tool-options\gimp-gegl-tool’
    INIT: gimp_real_restore
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\pluginrc’
    Querying plug-in: ‘c:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\pyconsole.py’
    Writing ‘C:\Users\Alexandre\.gimp-2.8\pluginrc’
    Starting extension: ‘extension-script-fu’
    INIT: gui_restore_after_callback
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\menurc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\devicerc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\controllerrc’
    Parsing ‘C:\Users\Alexandre\.gimp-2.8\colorrc’
    loading menu ‘c:\Program Files\GIMP 2\share\gimp\2.0\menus\image-menu.xml’ for /image-menubar
    Loading module ‘c:\Program Files\GIMP 2\lib\gimp\2.0\modules\libdisplay-filter-lcms.dll’
    No batch interpreter specified, using the default ‘plug-in-script-fu-eval’.
    batch command executed successfully

Leave a Reply

Copyright © 2002-2014
Tech Bloggings