Frequency-domain watermarking library and CLI
Project description
FDWM - Frequency Domain Watermarking
A Python library for embedding and extracting watermarks in images using frequency domain techniques. Supports both image and text watermarks with a command-line interface.
Features
- Frequency Domain Watermarking: Uses FFT (Fast Fourier Transform) to embed watermarks in high-frequency regions
- Image Watermarks: Embed and extract image-based watermarks
- Text Watermarks: Embed and extract text watermarks with OCR support
- Command Line Interface: Easy-to-use CLI for batch processing
- Multiple Languages: Support for various text languages
- Robust Extraction: High correlation coefficients for reliable watermark detection
Installation
From PyPI (Recommended)
pip install fdwm
From Source
git clone https://github.com/Liam0205/fdwm.git
cd fdwm
pip install -e .
Quick Start
Python API
import cv2
from fdwm import embed, extract, extract_text
# Load host image and watermark
host_img = cv2.imread('host.jpg')
watermark_img = cv2.imread('watermark.png')
# Embed watermark
watermarked_img = embed(host_img, watermark_img, strength=0.1)
# Extract watermark
extracted_watermark = extract(watermarked_img, watermark_img.shape[:2])
# For text watermarks
text = "Hello World"
watermarked_img = embed(host_img, text, strength=0.1, is_text=True)
extracted_text = extract_text(watermarked_img)
Command Line Interface
# Embed image watermark
fdwm embed host.jpg watermark.png -o watermarked.jpg
# Embed text watermark
fdwm embed host.jpg "Hello World" -o watermarked.jpg --text
# Extract image watermark
fdwm extract watermarked.jpg watermark.png -o extracted.png
# Extract text watermark
fdwm extract watermarked.jpg --text
CLI Usage
Embed Command
fdwm embed <host_image> <watermark> [options]
Options:
-o, --output PATH Output file path
--text Treat watermark as text
--strength FLOAT Embedding strength (default: 0.1)
--batch Process directory of images
Extract Command
fdwm extract <watermarked_image> <watermark> [options]
Options:
-o, --output PATH Output file path
--text Extract text watermark
--batch Process directory of images
Examples
Batch Processing
# Embed watermark in all images in a directory
fdwm embed images/ watermark.png --batch -o watermarked/
# Extract watermark from all images
fdwm extract watermarked/ watermark.png --batch -o extracted/
g
Text Watermarking
# Embed Chinese text
fdwm embed image.jpg "Hello World" --text -o watermarked.jpg
# Extract text
fdwm extract watermarked.jpg --text
Requirements
- Python 3.8+
- numpy
- opencv-python
- Pillow
- pytesseract
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- Based on frequency domain watermarking techniques
- Uses OpenCV for image processing
- Tesseract OCR for text extraction
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fdwm-0.1.0.tar.gz.
File metadata
- Download URL: fdwm-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a929e991d29a1c6cc28b1f22235330b6a7729f5788b515a9edf55ee98ede978
|
|
| MD5 |
3fdcf5318bfe2ab0e75ba77e9d4c3da5
|
|
| BLAKE2b-256 |
7ac6253f3d4eadd93721a783e95a3380eb1c280d36e5614c83e2aff871ad6795
|
Provenance
The following attestation bundles were made for fdwm-0.1.0.tar.gz:
Publisher:
workflow.yml on Liam0205/fdwm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fdwm-0.1.0.tar.gz -
Subject digest:
1a929e991d29a1c6cc28b1f22235330b6a7729f5788b515a9edf55ee98ede978 - Sigstore transparency entry: 254326789
- Sigstore integration time:
-
Permalink:
Liam0205/fdwm@2b6ea0c567a1a27e3428184ad16a88267e322500 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Liam0205
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@2b6ea0c567a1a27e3428184ad16a88267e322500 -
Trigger Event:
release
-
Statement type:
File details
Details for the file fdwm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fdwm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3432a72f434f297b5e5a695c57a0acd00513834461d95b3c356788ecd5a440c5
|
|
| MD5 |
151eddc34e0ca80a233096b3d5771cd9
|
|
| BLAKE2b-256 |
21b5fc53f9029c0df7d20fa747973fc335e1119bf6a0eec24e449eac32bb185e
|
Provenance
The following attestation bundles were made for fdwm-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on Liam0205/fdwm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fdwm-0.1.0-py3-none-any.whl -
Subject digest:
3432a72f434f297b5e5a695c57a0acd00513834461d95b3c356788ecd5a440c5 - Sigstore transparency entry: 254326792
- Sigstore integration time:
-
Permalink:
Liam0205/fdwm@2b6ea0c567a1a27e3428184ad16a88267e322500 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Liam0205
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@2b6ea0c567a1a27e3428184ad16a88267e322500 -
Trigger Event:
release
-
Statement type: