Home  >  Article  >  Backend Development  >  PHP function imagick generates grayscale difference pictures

PHP function imagick generates grayscale difference pictures

WBOY
WBOYOriginal
2016-07-25 08:51:351707browse
  1. $image = new Imagick('cyclops.png');

  2. $clone = $image->clone();

  3. $clone = $image->fximage('p{0,0}');
  4. $image->compositeImage($clone,imagick::COMPOSITE_DIFFERENCE,0,0);
  5. $image->modulateImage( 100, 0, 0);
  6. header( 'Content-Type: image/{$image->getImageFormat()}' );
  7. echo $image->getImageBlob( );
  8. writeImage('difference.png');

  9. $image->clear();
  10. $image->destroy();
  11. ?>
Copy the code

Source image: PHP function imagick generates grayscale difference pictures

Rendering (generated grayscale difference picture): PHP function imagick generates grayscale difference pictures



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