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 Link to comment https://forums.phpfreaks.com/topic/166955-solved-reading-pixels/ 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"; } } ?> Link to comment https://forums.phpfreaks.com/topic/166955-solved-reading-pixels/#findComment-880235 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.