In this tutorial you will learn how to add watermarks to images, videos and PDFs easily, with widely available tools on Linux.

Table of Contents


Command line tools


Stamp an image

If you don’t need to change the resolution and the opacity of the watermark image, adding a watermark can be as simple as:

magick composite -gravity southeast watermark.png image.jpg output.jpg
  • -gravity available values are: NorthWest, North, NorthEast, West, Center, East, SouthWest, South and SouthEast. Capitalization is optional.

To change opacity, add -dissolve <number>, where <number> goes from 0 (fully transparent) to 100 (fully opaque).

magick composite -gravity southeast -dissolve 50 watermark.png image.jpg output.jpg

If you want to change the watermark resolution:

magick composite -gravity SouthEast \( watermark.png -geometry 240 \) image.jpg output.jpg

You can use -compose parameter to set the type of image composition: multiply, screen, subtract, plus, add, difference, etc.

magick composite -gravity SouthEast \( watermark.png -geometry 300 -compose screen \) image.jpg output.jpg
Stamp text
magick convert input.jpg -pointsize 100 -gravity southeast -fill white -draw 'text 50,50 "Some text"' output.jpg

Graphical applications

Inkscape, GIMP

With these tools you can just open the images, place the watermark image on top of the main image and change watermark opacity (or composition mode).




Command line tools


If you don’t need to change watermark image resolution (or opacity), you can just run:

ffmpeg -i input.mp4 -i watermark.png -filter_complex 'overlay=10:10' output.mp4
  • overlay=10:10 places the watermark using X and Y coordinates (from the top-left). In this case, 10 pixels from the top and 10 pixels from the left. You can also use predefined parameters like main_h for video height, main_w for video width, overlay_h for watermark height and overlay_w for watermark width. For example, to center the watermark, use this “overlay”: 'overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2'.

If you want to change watermark resolution or opacity, best option is change it before with ImageMagick (or any other image editor):

magick convert watermark.png -resize 300 -alpha on -channel a -evaluate set 50% watermark-new.png

Graphical applications


After opening the video in Avidemux, select a video codec (e.g. x264), press Filters, double-click on Add logo and add your watermark image. You can change the position and opacity.



Command line tools


You’ll need a PDF file as watermark. You can create one using LibreOffice Draw (create a blank page with the watermark image). Then, with PDFtk, run (replace the filenames appropriately):

pdftk input.pdf background watermark.pdf output output.pdf

This will not work if the main PDF is a scanned image, because the background needs to be transparent. If your watermark has a transparent background, you can replace background with stamp and put the watermark on top of the main PDF.

Text stamps: enscript + ps2pdf + pdftk

To stamp text on a PDF, you can use this command which run enscript to create a .ps file from a text, ps2pdf to convert it to .pdf, and pdftk to create a watermarked file from that PDF.

echo "Some text" | \
enscript -B -f Courier16 -o- | \
ps2pdf - | \
pdftk input.pdf stamp - output output.pdf

You can also create several watermarked PDF files using a loop:



for i in {1..12}
    echo "Number: ${i}" | \
    enscript -B -f Courier16 -o- | \
    ps2pdf - | \
    pdftk $INPUT stamp - output ${OUTPUT}-${i}.pdf

Or add a different stamp per file page:

enscript -L1 -F Courier13 --header='||Page $% of $=' --output - < <(for i in {1..25}; do echo; done) | \
ps2pdf - | \
pdftk input.pdf multistamp - output output.pdf

Graphical applications

LibreOffice Draw

You can edit a PDF file in LibreOffice Draw and add an image (and optionally change opacity). This image will be below the OCR layer, so it will not interfere when selecting text.

LibreOffice Draw

PDF Chain

This tool is based on PDFtk, so it’s pretty simple to understand if you have read the PDFtk section. Go to Background/Stamp, select a document and the watermark, check Background and click Save as.

LibreOffice Writer

If you use Writer to create your PDFs, you can add a watermark (or a background image) by clicking Format -> Page Style.... Go to Area, select Image and add/import a new image. Then, under Style, select whether you want a stretched or tiled image, or a custom sized one. Choose the Position and go to Transparency tab to change the opacity. These options will apply to all pages.

LibreOffice Writer

If you have any suggestion, feel free to contact me via social media or email.