Blind Watermark

raw JSON →
0.4.4 verified Sat May 09 auth: no python

A Python library for embedding and extracting blind digital watermarks in images using DWT-DCT-SVD based algorithm. Current version 0.4.4, released irregularly.

pip install blind-watermark
error ModuleNotFoundError: No module named 'blind_watermark'
cause Package name is blind-watermark, but import is blind_watermark.
fix
pip install blind-watermark and import as from blind_watermark import WaterMark
error AttributeError: 'WaterMark' object has no attribute 'read_img'
cause Using outdated version <0.2.0 which had different API (e.g., bwm = BlindWatermark()).
fix
Upgrade to latest: pip install --upgrade blind-watermark
gotcha The library modifies the image in-place during embed; do not reuse the WaterMark object after embedding without re-reading images.
fix Create a new WaterMark() instance for each embed/extract operation.
deprecated Method 'embed' returns None, not the watermarked image array. Use 'embed' to save to file; later versions may add return value.
fix Use embed with a file path; if you need array, use embed(..., output_file_name=None) (check docs).
gotcha read_wm expects a file path or a watermark image path; if the watermark image is too large relative to host, embedding may fail silently.
fix Ensure watermark dimensions are smaller than host; typical max ratio 1/4.

Embed a watermark image into a host image, then extract it.

from blind_watermark import WaterMark

bwm = WaterMark()
bwm.read_img('original.png')
bwm.read_wm('watermark.png')
bwm.embed('output.png')

bwm2 = WaterMark()
wm_extract = bwm2.extract('output.png', 'extracted_watermark.png')
print('Watermark extracted successfully')