1. Go to this page and download the library: Download kid1296/blind-watermark library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kid1296 / blind-watermark example snippets
id1296\BlindWatermark\WaterMark;
// ========== embed ==========
$bwm1 = new WaterMark(passwordWm: 1, passwordImg: 1);
$bwm1->read_img('examples/pics/origin.jpg');
$wm = 'This is a test sentence.';
$bwm1->read_wm($wm, 'str');
$bwm1->embed('examples/output/embedded_str.png');
$lenWm = $bwm1->wmSize; // remember this length
// ========== extract ==========
$bwm2 = new WaterMark(passwordWm: 1, passwordImg: 1);
$extracted = $bwm2->extract(
filename: 'examples/output/embedded_str.png',
wmShape: $lenWm,
mode: 'str'
);
// $extracted === 'This is a test sentence.'