最佳答案
这会将白色替换为灰色
$imgname = "test.gif";
$im = imagecreatefromgif ($imgname);
$index = imagecolorclosest ( $im, 255,255,255 ); // get White COlor
imagecolorset($im,$index,92,92,92); // SET NEW COLOR
$imgname = "result.gif";
imagegif($im, $imgname ); // save image as gif
imagedestroy($im);
关于php - 我可以使用 PHP 中的 GD 库交换图像中的颜色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/456044/