How to loop through all the pixels of an image?
问题 I want to loop through all the pixels of an image, find the rgba value of that pixel, and do something with those pixels. Example Say I have an image that's 100x100 pixels. I want to find the value of each one of those pixels with the function I already made: function getPixel($image, $x, $y) { $colors = imagecolorsforindex($image, imagecolorat($image, $x, $y)); $inrgba = 'rgba(' . $colors['red'] . ',' . $colors['green'] . ',' . $colors['blue'] . ',' . $colors['alpha'] . ')'; return $inrgba;