php函数imagick生成灰度差异图片
imagick代码:
<?php
$image = new Imagick('cyclops.png');
$clone = $image->clone();
$clone = $image->fximage('p{0,0}');
$image->compositeImage($clone,imagick::COMPOSITE_DIFFERENCE,0,0);
$image->modulateImage(100, 0 , 0);
header( 'Content-Type: image/{$image->getImageFormat()}' );
echo $image->getImageBlob( );
//$image->writeImage('difference.png');
$image->clear();
$image->destroy();
?>
源图片:
效果图(生成的灰度差异图片):