Noted in another thread about watermarking using digikam, and thought Id share how I go about it using imagemagick and a script to do a batch of images in a folder.
My reasoning is I dont use digikam, and cant be bothered going through darktable history and removing the watermark if someone wished to purchase a print/file.
- export from darktable/whatever to the
- run the script, it will take every image from the
/sourcefolder, resize and add watermark, and export to a
- check the images in the
/watermarkeddirectory are as I want, upload/whatever.
It’s nice once set up, and is pretty speedy.
Here’s the script for 1920 on whichever long edge:
#!/bin/bash for i in ./source/*.jpg ./source/*.jpeg ./source/*.png do if [ ! -d "./watermarked" ]; then mkdir "./watermarked"; fi filename=$(basename "$i") /bin/convert \ -filter Lanczos \ "$i" \ -set option:filter:filter Lanczos \ -set option:filter:blur 0.8 \ -resize 1920x1920 \ -quality 90 \ ./Logo/SIF_Logo_300.png -gravity SouthEast -geometry +20+15 -compose Multiply -composite \ "./watermarked/$filename" done
if you want a windows batch file:
@echo off FOR %%i IN (./\*.jpg ./\*.jpeg ./\*.png) DO ( IF NOT EXIST ./\watermarked mkdir watermarked convert ^ -filter Lanczos ^ "%%i" ^ -set option:filter:filter Lanczos ^ -set option:filter:blur 0.8 ^ -resize 1920x1920 ^ -quality 90 ^ ./Logo/SIF_Logo_300.png -gravity SouthEast -geometry +20+15 -composite ^ "./\watermarked\%%~nxi" )
Bit of a breakdown of what its doing, and so you can modify to suit you:
Top part sets up the folders, created the output folder if it’s not there.
Next lines are the filtering for the resize, and the dimensions for the long edge; adjust as you see fit.
And output jpg quality.
source for the watermark image, I have watermarks in a subfolder
/Logo - the preceding dot tells it that it’s a sub-folder from the script folder.
-gravity North/South/etc sets starting point of Logo position
-geometry Lat/Long offset from starting position. Change the values and you’ll work it out.
-compose Multiply adds the image using “multiply” like a photoshop filter; whites fade into he background. I just like how it looks sometimes, it’s not essential.
-composite combines the original image and the watermark
Obviously you will need imagemagick installed from your repo. Or the website if you’re on Windows.
Credit: How to automatically watermark or batch watermark photos using ImageMagick | xoogu