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

Is age interval or ordinal data?

515


How do I start a php session?

532


Which functions are used to count the total number of array elements in php?

531


How to turn on the session support in php?

525


What is smarty?

492






How to move uploaded files to permanent directory?

527


What are php keywords?

529


What is a static method php?

510


What are the differences between php3 and php4 and php5? What is the current stable version of php? What advance thing in php7?

611


What is the purpose of the '.myd' file extension? What do thes file contain?

531


What are the advantages of indexes?

495


How can we automatically escape incoming data?

532


What is the use of mysql_fetch_assoc in php?

504


What is the meaning of a final class and a final method?

527


How to redirect https to http url through .htaccess?

492