array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'imagick.compareimages.php', 1 => 'Imagick::compareImages', ), 'up' => array ( 0 => 'class.imagick.php', 1 => 'Imagick', ), 'prev' => array ( 0 => 'imagick.compareimagelayers.php', 1 => 'Imagick::compareImageLayers', ), 'next' => array ( 0 => 'imagick.compositeimage.php', 1 => 'Imagick::compositeImage', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imagick/imagick/compareimages.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL imagick 2, PECL imagick 3)
Imagick::compareImages — Compares an image to a reconstructed image
Returns an array containing a reconstructed image and the difference between images.
compare
An image to compare to.
metric
Provide a valid metric type constant. Refer to this list of metric constants.
Returns an array containing a reconstructed image and the difference between images.
Wirft ImagickException bei Fehlern.
Beispiel #1 Using Imagick::compareImages():
Compare images and display the reconstructed image
<?php
$image1 = new imagick("image1.png");
$image2 = new imagick("image2.png");
$result = $image1->compareImages($image2, Imagick::METRIC_MEANSQUAREERROR);
$result[0]->setImageFormat("png");
header("Content-Type: image/png");
echo $result[0];
?>