src/ImageMagick.php
public function compareImages($expectedImage, $compareImage, $resultImageName, $resultImageDirectory)
	{
		$time = date('Ymd-His');

		$diffResult    = $this->createDiffGifOnDifferences($expectedImage, $compareImage,
		                                                   $resultImageName . 'Diff' . $time, $resultImageDirectory);
		$compareResult = $this->createComparisonImageOnDifferences($expectedImage, $compareImage,
		                                                           $resultImageName . 'Compared' . $time,
		                                                           $resultImageDirectory);
		if($diffResult || $compareResult)
		{
			$gif = $resultImageName . 'Diff' . $time . '.gif';
			$png = $resultImageName . 'Compared' . $time . '.gif';

			return [$gif, $png];
		}

		return [];
	}
public function compareImages($expectedImage, $compareImage, $resultImageName, $resultImageDirectory)
	{
		$time = date('Ymd-His');

		$diffResult    = $this->createDiffGifOnDifferences($expectedImage, $compareImage,
		                                                   $resultImageName . 'Diff' . $time, $resultImageDirectory);
		$compareResult = $this->createComparisonImageOnDifferences($expectedImage, $compareImage,
		                                                           $resultImageName . 'Compared' . $time,
		                                                           $resultImageDirectory);
		if($diffResult || $compareResult)
		{
			$gif = $resultImageName . 'Diff' . $time . '.gif';
			$png = $resultImageName . 'Compared' . $time . '.gif';

			return [$gif, $png];
		}

		return [];
	}
Compares two images and create a diff gif images and a compare image.

@param string $expectedImage        Path to expected image.
@param string $compareImage         Path to compare image.
@param string $resultImageName      Name of result gif, if the images not looking equal.
@param string $resultImageDirectory (Optional) Path to result image directory. If not set, the cwd is used.

@return array Empty if both images looking equal, otherwise an array with the created image names (without the
directory)