Jump to content

[SOLVED] Reading Pixels


cs1h

Recommended Posts

Something like this?

<?php
$image  = imagecreatefrompng("/path/to/file.png");
$width  = imagesx($image);
$height = imagesy($image);
for($y=0; $y<$height; $y++) {
    for($x=0; $x<$width; $x++) {
        $rgb = imagecolorat($image,$x,$y);
        echo "Pixel $x , $y colour: $rgb\n";
    }
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.