php函数imagick实现平铺整张图片的水印效果
时间:2021-07-01 10:21:17
帮助过:157人阅读
$image = new Imagick('logo.jpg'); $im = new Imagick(); - $im->newImage( 140, 80, new ImagickPixel( "none" ) );
- $draw = new ImagickDraw();
$draw->setFillColor(new ImagickPixel( "grey" )); - $draw->setGravity(imagick::GRAVITY_NORTHWEST);
- $draw->annotation(10,10 ,'Copyright');
- $draw->setGravity(imagick::GRAVITY_SOUTHEAST);
- $draw->annotation(5,15 ,'Copyright');
$im->drawImage( $draw); - $image = $image->textureImage($im);
- $image->compositeImage($image,imagick::COMPOSITE_COPY,0,0);
- header( "Content-Type: image/{$image->getImageFormat()}" );
$image->writeImage('wmark_text_tiled.jpg'); - $image->clear();
- $image->destroy();
- ?>
源图片:
效果图:
|