我需要使用 PHP 和 GD 混淆图像的某个区域,目前我正在使用以下代码:
for ($x = $_GET['x1']; $x < $_GET['x2']; $x += $pixel)
{
for ($y = $_GET['y1']; $y < $_GET['y2']; $y += $pixel)
{
ImageFilledRectangle($image, $x, $y, $x + $pixel - 1, $y + $pixel - 1, ImageColorAt($image, $x, $y));
}
}
这基本上将选定区域替换为 $pixel 像素的正方形。我想完成某种模糊(最好是高斯)效果,我知道我可以使用 ImageFilter() 函数:
ImageFilter($image, IMG_FILTER_GAUSSIAN_BLUR);
但它模糊了整个画布,我的问题是我只想模糊一个特定区域。