Home  >  Article  >  Backend Development  >  PHP function imagick realizes the watermark effect of tiling the entire picture

PHP function imagick realizes the watermark effect of tiling the entire picture

WBOY
WBOYOriginal
2016-07-25 08:51:391308browse
  1. $image = new Imagick('logo.jpg');

  2. $im = new Imagick();

  3. $im->newImage( 140, 80, new ImagickPixel( "none" ) );
  4. $draw = new ImagickDraw();
  5. $draw->setFillColor(new ImagickPixel( "grey" ));

  6. $draw->setGravity(imagick::GRAVITY_NORTHWEST);
  7. $draw->annotation(10,10 ,'Copyright');
  8. $draw->setGravity(imagick::GRAVITY_SOUTHEAST);
  9. $draw->annotation(5,15 ,'Copyright');
  10. $im->drawImage( $draw);

  11. $image = $image->textureImage($im);
  12. $image->compositeImage($image,imagick::COMPOSITE_COPY,0,0);
  13. header( "Content-Type: image/{$image->getImageFormat()}" );
  14. $image->writeImage('wmark_text_tiled.jpg');

  15. $image->clear();
  16. $image->destroy();
  17. ?>
复制代码

源图片: PHP function imagick realizes the watermark effect of tiling the entire picture

效果图: PHP function imagick realizes the watermark effect of tiling the entire picture



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn