I have two images (both maps) one is a plain map and one is a map that had pins on it.
Image one
Image Two
I'm trying to subtract them from each other so I'm left with just the pins as a transparent png.
I've had some success with this and have managed to get the pins as their own image, the problem is that the colours aren't quite right (see image 3).
Image Three
I'm using Imagick to do this and my code is below
<?php
// load in the base image into Imagick
$imageOne = new Imagick('images/base-map.png');
$imageTwo = new Imagick('images/pins/location-7.png');
$imageOne->compositeImage($imageTwo, Imagick::COMPOSITE_DIFFERENCE, 0, 0);
$imageOne->paintTransparentImage($imageOne->getImagePixelColor(0, 0), 0, 5000);
header('Content-Type: image/png');
echo $imageOne;
Does anyone know how I can tidy/tweak this to make the colours match the original image?
Thanks!