Thanks to visit codestin.com
Credit goes to lib.rs

#image-processing #pdf #image #identity-theft

app watermark-cli

A command-line tool for adding watermarks to images with support for batch processing and various watermark patterns

10 stable releases

Uses new Rust 2024

1.2.2 Apr 16, 2026
1.2.0 Jan 20, 2026
1.1.5 Oct 19, 2025
1.1.4 Sep 28, 2025
1.1.2 May 31, 2025

#2247 in Command line utilities

GPL-3.0-only

160KB
328 lines

Watermark CLI

A command-line tool for adding watermarks to images and PDFs with support for batch processing and various watermark patterns. Designed to prevent identity theft and unauthorized copying of official documents through visible watermarking.


Features

  • Apply text watermarks with specific rotation.
  • PDF as input is supported
  • Process single images or recursively process directories
  • Parallel processing for batch operations using Rayon
  • Customizable watermark color and spacing and JPEG compression quality

Installation

Prerequisites

  • Rust and Cargo installed on your system

Install from crates.io

cargo install watermark-cli

Building from source

Windows

windows-sys require some dll to build:

scoop install binutils
git clone https://github.com/chianti-ga/watermark-cli.git
cd watermark-cli
cargo build --release

Usage

watermark-cli <INPUT_PATH> <WATERMARK> [OPTIONS]

Arguments

  • <INPUT_PATH> - Path to the input image/pdf file or directory
  • <WATERMARK> - Text to use as watermark

Options

  • -q, --quality <JPEG QUALITY> - JPEG quality 1–100 [default: 90]
  • -s, --space-scale <SPACE_SCALE> - Vertical spacing between watermarks [default: 1.5]
  • -t, --text-scale <TEXT_SCALE> - Watermark text scale [default: 0.05"]
  • -r, --recursive - Recursively apply watermark to all images in the specified directory
  • -c, --color <COMPRESSION> - Color for the watermark text [default: "128, 128, 128, 150"]
  • -p, --pattern <PATTERN> - Pattern of watermark [default: diagonal] [possible values: diagonal, horizontal, vertical, random, cross-diagonal] (NOT IMPLEMENTED AT THE MOMENT)
  • -h, --help - Print help
  • -V, --version - Print version

Examples

Apply a diagonal watermark to a single image:

watermark-cli sample.png "ONLY FOR IDENTITY VERIFICATION BY RENTAL AGENCY"
Original file Watermarked file
Original file Watermarked file

Customize watermark height/scale and compression:

watermark-cli --text-scale 2.0 path/to/image.jpg "SAMPLE"

Process all images in a directory recursively with a custom pattern:

watermark-cli --recursive --pattern horizontal path/to/directory/ "Confidential"

Customize watermark spacing and compression:

watermark-cli --space-scale 2.0 --compression 80 path/to/image.jpg "SAMPLE"

Supported File Formats

  • JPEG/JPG
  • PNG
  • WebP

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Font License

This project uses the Open Sans font, which is licensed under the SIL Open Font License, Version 1.1 . The font was designed by Steve Matteson and is available at https://fonts.google.com/specimen/Open+Sans.

Dependencies

~65MB
~1.5M SLoC