$filename = 'path/to/image.png';
$color = '255,255,255';
$img = imagecreatefrompng($filename);
$colors = explode(',', $color);
$remove = imagecolorallocate($img, $colors[0], $colors[1], $colors[2]);
imagecolortransparent($img, $remove);
imagepng($img, $filename);
$r > 210 and $g > 210 and $b >210
красим его в черный$filename = 'data/output/test.png';
$image = imagecreatefrompng($filename);
$black = imageColorAllocate($image, 0, 0, 0);
$size = getimagesize($filename);
$w = $size[0];
$h = $size[1];
for ($x=0; $x < $w; $x++){
for ($y=0; $y < $h; $y++){
$color = imagecolorat($image, $x, $y);
$r = ($color >> 16) & 0xFF;
$g = ($color >> 8) & 0xFF;
$b = $color & 0xFF;
if ($r > 210 and $g > 210 and $b > 210){
imagesetpixel($image, $x , $y, $black);
}
}
}
imagecolortransparent($image, $black);
$res_path = 'data/output/result.png';
imagepng($image, $res_path, 9, NULL);
imagedestroy($image);