Registry / data / invisible-watermark

invisible-watermark

JSON →
library0.2.0pypypi✓ verified 82d ago

Invisible Watermark is a Python library designed for robustly embedding and extracting invisible watermarks within images. It provides functionalities to encode arbitrary text or data into an image without perceptibly altering its visual appearance, and subsequently decode the hidden information. The library is actively developed, currently at version 0.2.0, with releases occurring periodically to introduce features and fixes.

pip install invisible-watermark
INSTALL
IMPORT
SIG · INVISIBLE-WATERMAR
I
invisible-watermark
datapythonv0.2.0
Install
71.2s avg
Import
Disk
5094MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 79.03s
py 3.11
✕ build_error
✓ 73.13s
py 3.12
✕ build_error
✓ 69s
py 3.13
✕ build_error
✓ 63.68s
py 3.9
✕ build_error
1/4 runs
5094MB installed
● package 5094MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WatermarkEncoder
from imwatermark import WatermarkEncoder
from invisible_watermark import InvisibleWatermark
WatermarkDecoder
from imwatermark import WatermarkDecoder
from invisible_watermark import InvisibleWatermark

This quickstart demonstrates how to create a dummy image, then initialize the InvisibleWatermark library to encode a text watermark into it, and finally decode the watermark from the saved output image.

import os from PIL import Image from invisible_watermark import InvisibleWatermark # 1. Create a dummy image for demonstration if it doesn't exist image_filename = "dummy_input_image.png" output_filename = "dummy_watermarked_image.png" if not os.path.exists(image_filename): img = Image.new('RGB', (256, 256), color = 'red') img.save(image_filename) print(f"Created dummy image: {image_filename}") # 2. Initialize the watermark library iwm = InvisibleWatermark() # 3. Define the watermark text watermark_text = "SecretMessage123" print(f"Original watermark: {watermark_text}") # 4. Encode the watermark into the image iwm.encode(image_filename, output_filename, watermark_text) print(f"Watermark encoded and saved to: {output_filename}") # 5. Decode the watermark from the watermarked image decoded_text = iwm.decode(output_filename) print(f"Decoded watermark: {decoded_text}") # 6. Clean up generated files (optional) # os.remove(image_filename) # os.remove(output_filename)
Debug
Known issues
gotchaThe library heavily relies on `opencv-python` for image processing. Installation of `opencv-python` can sometimes be challenging or lead to `ModuleNotFoundError: No module named 'cv2'` on certain systems (e.g., ARM processors, headless servers without GUI dependencies).
fix
Ensure `opencv-python` (or `opencv-python-headless` for server environments) is successfully installed. You may need to manually verify `import cv2` works. For persistent issues, consult OpenCV installation guides for your specific OS/architecture.
affects: 0.1.x - 0.2.x
gotchaThe `encode` method expects image paths that `cv2.imread()` can successfully load. Using incorrect file paths, unsupported image formats, or corrupted images will result in failures or `NoneType` errors.
fix
Always double-check image paths for correctness (absolute vs. relative). Prior to using the library, verify images are readable by OpenCV: `import cv2; img = cv2.imread('your_image.jpg'); if img is None: print('Failed to load image')`.
affects: 0.1.x - 0.2.x
gotchaAs an early-stage library (version 0.2.0), the API is still evolving. While specific breaking changes weren't extensively documented between 0.1.x and 0.2.x, future minor or patch versions could introduce them without comprehensive migration guides.
fix
It is recommended to pin your `invisible-watermark` version in your `requirements.txt` (e.g., `invisible-watermark==0.2.0`) and review release notes or the GitHub repository for any breaking changes before upgrading.
affects: 0.x
Upgrade
Version history
0.2.0latest on PyPI · released Jul 6, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
Bingbot
1
Resources
invisible-watermark — pip install invisible-watermark · libregistry