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

Answer Posted / jude jeevanraj.p

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are react hooks stable?

518


Does cors prevent csrf?

529


What are the __construct() and __destruct() methods in a php class?

509


How can you propagate a session id?

537


Where is session value stored php?

538






Explain object-oriented methodology in php?

582


Can we embedded directly PHP code into XHTML document? State Whether True or False?

1262


What is the use of Mbstring?

538


Explain the difference between array_merge() and array_combine()?

533


How do you put a space in html?

516


How many types of array supported in php?

534


What type of operation is needed when passing values through a form or an url?

526


sort term descripttion form, report and uery

1653


Can you explain, when to use if-else if-else over switch statements?

536


Tell me how can we check the value of a given variable is alphanumeric?

495