我希望能够遍历图像的所有像素,找到该像素的rgba值,并对这些像素进行处理。
将这些值与图像的尺寸存储在数组中,或者是数组的数组中。最终结果将用于html页面。如何实现?
示例
假设我有一个100x100像素的图像。我想使用我已经创建的函数找到每个像素的值:
function getPixel($image, $x, $y) {
$colors = imagecolorsforindex($image, imagecolorat($image, $x, $y));
$inrgba = 'rgba(' . $colors['red'] . ',' . $colors['green'] . ',' . $colors['blue'] . ',' . $colors['alpha'] . ')';
return $inrgba;
}
将这些值与图像的尺寸存储在数组中,或者是数组的数组中。最终结果将用于html页面。如何实现?