Php uses the imagecopymerge () function to create a translucent watermark,
Use the imagecopymerge () function to create a translucent watermark for your reference. The specific content is as follows:
<? Php // load the image to be watermark $ im = imagecreatefrom#('photo.jpeg '); // first, we manually create the watermark image $ stamp = imagecreatetruecolor (100, 70) from GD; imagefilledrectangle ($ stamp, 0, 0, 99, 69, 0x0000FF); imagefilledrectangle ($ stamp, 9, 9, 90, 60, 0 xFFFFFF); imagestring ($ stamp, 5, 20, 20, 'libgd ', 0x0000FF); imagestring ($ stamp, 3, 20, 40,' (c) 2007-9 ', 0x0000FF ); // set the position and size of the watermark image $ marge_right = 10; $ marge_bottom = 10; $ sx = imagesx ($ stamp); $ s Y = imagesy ($ stamp); // merge watermarks and images with 50% transparency ($ im, $ stamp, imagesx ($ im)-$ sx-$ marge_right, imagesy ($ im)-$ sy-$ marge_bottom, 0, 0, imagesx ($ stamp), imagesy ($ stamp), 50); // Save the image to a file, and release the imagepng ($ im, 'photo_stamp.png '); imagedestroy ($ im);?>
Translucent watermark:
This example uses the imagecopymerge () function to merge the watermark image and the original image. We can control the watermark transparency, which is 50% in this example. In practice, you can use a translucent watermark to protect your copyright without affecting your image.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.