Create a custom watermark and easily apply it from the right click menu
Custom watermark Thunar action
Basic Tab
Name: Watermark
Description: Watermark images
Command: bash ~/bin/watermark.sh %n '/path-to/watermark.png'
Appearance Conditions Tab
File Pattern: *
Appears if selection contains: Image Files
To add a custom action open Thunar file manager from the menu select Edit -> Configure custom actions…
The Bash Script
#!/bin/bash
# Requires jpegoptim, imagemagick.
#
# Example usage: bash ~/bin/watermark.sh input.png '~/watermark.png'
#
# Thunar Action Setup
#
# Command: bash ~/bin/watermark.sh %n '/path-to/watermark.png'
# Use Startup Notification: Checked
# Appearance Conditions
# File Pattern: *
# Appears if selection contains: Image Files
set -ex
# Input filename and extension
FILE="$1"
EXTENSION="${FILE##*.}" # Extract extension from filename
# Input filename without extension
NAME="${FILE%.*}"
# Watermark image file
WATERMARK_IMAGE="$2"
# Target image size for resizing
IMAGE_SIZE='1000x1000'
# Construct a unique name with date and time
NAME_DATE=$(basename "${NAME}")_$(date +"%d%m%Y%S")
# Copy the original file to a new name with the determined extension
cp "${FILE}" "${NAME_DATE}.${EXTENSION}"
# Resize the copied image
convert "${NAME_DATE}.${EXTENSION}" -resize "${IMAGE_SIZE}" -flatten "${NAME_DATE}.${EXTENSION}"
# Apply watermark
convert "${NAME_DATE}.${EXTENSION}" "${WATERMARK_IMAGE}" -gravity center -compose over -composite "${NAME_DATE}.jpg"
# Optimise JPEG quality
jpegoptim -s -m 90 "${NAME_DATE}.jpg"
# Remove the intermediate processed file
if [ "${EXTENSION,,}" != "jpg" ]; then
rm "${NAME_DATE}.${EXTENSION}"
fi
exit
The examples on this page use the bin directory within the user’s Home directory. Home -> User -> bin. Place the script in the bin folder.
Description
This Thunar action applies a defined watermark. It requires jpegoptim, ImageMagick, and your custom watermark in PNG format with transparency.
An easy way to create a repeating pattern using GIMP is as follows: Open the original image in GIMP and from the menu, select Filters -> Map -> Tile. Define the width and height of the final image. To get complete coverage for a repeating pattern, the dimensions must be larger than the image you intend to apply your mark.
A high-resolution graphic will cover most images without the need to create variations. This method also gives you complete control over the visual appearance of the watermark, ensuring it looks exactly as you intend.
A repeating pattern is only one idea as the image applied could be anything at all with transparency.
More Thunar actions related to graphics, GIMP Thumbnails or bash automation