cs1h Posted July 22, 2009 Share Posted July 22, 2009 Hi, Does anyone know a way to read each pixel from an image so that each individual pixel can be put through a program one at a time using php? Thanks, Cs1h Quote Link to comment Share on other sites More sharing options...
zq29 Posted July 22, 2009 Share Posted July 22, 2009 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"; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.