Home > Backend Development > PHP Tutorial > php imagick function sets the picture background to be transparent

php imagick function sets the picture background to be transparent

WBOY
Release: 2016-07-25 08:51:34
Original
2165 people have browsed it
  1. $image = new Imagick('1.png');

  2. $image->borderImage(new ImagickPixel("white"),1,1);
  3. $image->paintfloodfillimage('transparent',2000,NULL,0,0);
  4. $draw = new ImagickDraw();
  5. $draw->color(0,0,imagick::PAINT_FLOODFILL);
  6. $image->drawImage($draw);
  7. $image->shaveImage(1,1);
  8. header("Content-Type: image/{$image->getImageFormat()}");
  9. echo $image->getImageBlob( );

  10. //$image->writeImage('o.png');

  11. $image->clear();
  12. $image->destroy();
  13. ?>

复制代码

源图片: php imagick函数图片背景透明

效果图: php imagick函数图片背景透明



source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template