How to compare two images with PHP?

Asked

Viewed 1,569 times

1

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

1 answer

3


Image comparison in php is used with the library imagemagik 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];

?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.