Download the PHP package kid1296/blind-watermark without Composer
On this page you can find all versions of the php package kid1296/blind-watermark. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kid1296/blind-watermark
More information about kid1296/blind-watermark
Files in kid1296/blind-watermark
Package blind-watermark
Short Description PHP Library for DWT‑DCT‑SVD Blind Image Watermark.
License MIT
Informations about the package blind-watermark
BlindWatermark
PHP Library for Blind&Invisible Image Watermark.
- 中文 README_ZH.md
Features
| Item | Before | Now |
|---|---|---|
| Speed (940×940 embed) | ~4.9 s | ~2.5 s (2× faster) |
| Speed (extract) | ~3.8 s | ~1.5 s (2.5× faster) |
| Peak memory (embed+extract, 940×940) | required memory_limit=2G |
~61 MB (fits in default 128 MB) |
| Peak memory (1358×780) | OOM at 128 MB | ~81 MB |
| Image quality (PSNR, 940×940) | ~36.9 dB | 35.6 dB |
| Robustness (salt-pepper / bright / shelter / crop) | PASS | PASS |
| Robustness (resize, natural photo) | PASS | PASS |
PSNR 35–40 dB is generally considered "visually lossless" for photographs. The
d1/d2default was reduced from 36/20 to 27/15 for higher PSNR, while still tolerating salt-pepper / brightness / shelter / crop attacks on typical host images.
Requirements
- PHP >= 8.1
- GD extension (enabled by default in most PHP distributions)
The GD extension is required for all image I/O (reading JPEG/PNG, writing PNG, and applying attack simulations such as resize / salt-pepper / brightness). Verify with
php -m | grep gd.
Install
Usage
All examples run with the default PHP memory limit — no
-d memory_limit=2Gflag is needed anymore (peak memory stays well under 128 MB even for 1.3 megapixel images).
01 Embed & Extract — String Watermark
Original image + watermark text = invisible watermark image.
Full example: 01_embed_extract_str.php
Output:
02 Embed & Extract — Bit-Array Watermark
Embed an arbitrary array of 0/1 bits (useful for custom protocols / binary payloads).
Full example: 02_embed_extract_bit.php
Output:
03 In-Memory Pipeline (No-Temp-Files)
Suited for web services: read host image from request / database, embed, return BGR data directly without touching disk.
Full example: 03_in_memory.php
Output:
04 Attack / Recover — Robustness Test
Demonstrates the watermark surviving common post-processing attacks, plus crop-and-recover.
Embedded image (host = origin.jpg, wm = 'This is a attack test'):
Attack results (watermark extracted successfully from every image below):
| salt-pepper 2% | brightness ×0.9 | resize 940²→800×600 |
|---|---|---|
| shelter 5 blocks @5% | crop right 20% | crop recovered |
|---|---|---|
Full example: 04_with_attacks.php
Note on resize robustness: The resize attack uses GD's bilinear re-sampling. It works reliably on typical photographs with good tonal range (like
origin.jpg, mean ≈ 120, stdev ≈ 40). It may fail on extremely uniform / near-solid-colour host images (e.g. mean > 250/255) because the relative watermark strength is too low to survive the low-pass filter. This is a fundamental limitation of the DWT-DCT-SVD blind-watermark paradigm, not a library bug. To verify resize robustness, run the example withorigin.jpgas the host.
Reference Project
All versions of blind-watermark with dependencies
ext-gd Version *