moon 111 Posted March 22, 2008 Share Posted March 22, 2008 How could I open and read the pixel of an image? Could I use a regular function like you would use with a .txt file? If so what values am I looking for? Link to comment https://forums.phpfreaks.com/topic/97381-reading-pixels-of-images/ Share on other sites More sharing options...
Orio Posted March 22, 2008 Share Posted March 22, 2008 <?php $x = 10; $y = 8; $image = imagecreatefromjpeg("image.jpg"); //or imagecreatefromgif(), imagecreatefrompng(), ... $thiscol = imagecolorat($image, $x, $y); $rgb = imagecolorsforindex($image, $thiscol); echo "At pixel {$x},{$y} the color is RGB = {$rgb['red']},{$rgb['green']},{$rgb['blue']}"; ?> Orio. Link to comment https://forums.phpfreaks.com/topic/97381-reading-pixels-of-images/#findComment-498293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.