PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How can I find the colour of a pixel of an image?


This is easily done through using the imagecolorat function.

You must pass as parameters the image resource, and the x and y co-ordinates you want to find the color of, for instance:

$rgb = imagecolorat($im, 5, 10);

Will get a reference to the colour used at 5,10 (X,Y) on the image.

Depending on the version of the GD library you are using and the type of image, you may experience different return values, for more information take a look at:

http://uk3.php.net/manual/en/function.imagecolorat.php


More images PHP Questions

How can I add text to an image?
How can I rotate an image?
How can I find the width and height of an image resource?