PHP package by Undemanding to calculate how much difference (in percent) there is between two images:
use Undemanding\Difference\Image;
use Undemanding\Difference\Method\EuclideanDistance;
$image1 = new Image("/path/to/image1.png");
$image2 = new Image("/path/to/image2.png");
$difference = $image1->difference($image2, new EuclideanDistance());
$boundary = $difference->boundary(); // → ["left" => ..., "top" => ...]
$percentage = $difference->percentage(); // → 14.03...
Did you know you can visually diff two images using just one line of CSS?