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

Answer Posted / laxmikant

<?php
$im = imagecreatefrompng("php.png");
$rgb = imagecolorat($im, 10, 15);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;

var_dump($r, $g, $b);
?>

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does facebook use php framework?

556


What is faster?

557


What are the functions of string?

522


How to get useful error messages in php?

565


How php statement is different from php script?

536






Write a query to find the 2nd highest salary of an employee from the employee table?

644


What is warning – “cannot modify header information – headers already sent”?

628


what is constructor

1069


What is the use of super-global arrays in php?

505


Explain different sorting function in php?

606


How to find length of an array in php ?

554


What is the function mysql_pconnect() usefull for?

547


What would occur if a fatal error was thrown in your php program?

539


How do I escape data before storing it in the database?

573


How do I know my xampp version?

518