4
for ($j = 0; $j < $altura; $j++) {
for ($i = 0; $i < $largura; $i++) {
$rgb = imagecolorat($img, $i, $j);
$rgb = imagecolorsforindex($img, $rgb);
$imagem[$c] = $rgb['red'] + $rgb['green'] + $rgb['blue'];
$e = 9;
$codigo = round(($e * $imagem[$c])/765);
echo $codigo;
$c = $c + 1;
}
echo '<br>';
}
For now, what the code does is convert the RGB values by adding them together to get a number on a scale from 0 to 9. I want you to, instead of printing numbers, print black/gray hued pixels. I mean, I want to convert the image to black and white.
Creating Divs and loading the background-color with the colors would not solve?
– Alexandre Cavaloti