Skip to content

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.

License

Notifications You must be signed in to change notification settings

chianti-ga/watermark-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • -c, --compression <COMPRESSION> - JPEG quality (1-100) [default: 90]
  • -t, --text-scale <TEXT_SCALE> - Watermark text scale [default: 0.05"]
  • -s, --space-scale <SPACE_SCALE> - Vertical spacing between watermarks [default: 1.5]
  • -r, --recursive - Recursively apply watermark to all images in the specified directory
  • -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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published