How to compare two images with PHP?

1

Is there any tool or way to create a comparison of images with PHP? I need the system to identify when one image is not the same as another.

    
asked by anonymous 24.09.2014 / 15:40

1 answer

3

Image comparison in php is used with the imagemagik library. as follows

<?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];

?>
    
24.09.2014 / 15:52