I'm working on a t-shirt designer and got stuck with one problem. When I upload custom artwork into the system I automatically remove the background of the uploaded image. But for some reason it is not being removed completely.
Image example:
This is pretty much how the art is being presented most of the time all those white pixels aren't fully removed.
I have a simple code right now, and don't have an access to Imagick.
protected function remove_image_background($image, $bgcolor)
{
$bg_a = imagecolorallocatealpha($image, $bgcolor['red'], $bgcolor['green'], $bgcolor['blue'], 127);
imagealphablending($image, false);
imagesavealpha($image, true);
imagefill($image, 0, 0, $bg_a);
return $image;
}