Jump to content

Reading pixels of images


moon 111

Recommended Posts

<?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.

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.