PHP获取图片每个像素点
$i = imagecreatefromjpeg("test.jpg"); //图片路径
for ($x = 0; $x < imagesx($i); $x++) {
for ($y = 0; $y < imagesy($i); $y++) {
$rgb = imagecolorat($i, $x, $y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
echo "($r,$g,$b)";
//echo "$rgb ";
}
echo "/n";
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/19120.html