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

How I can control asset documents without GR/IR?

1276


What do you mean range() in php?

684


How to merge values of two arrays into a single array?

563


How do you check is php not empty?

636


How many escape sequences are recognized in single-quoted strings?

580






Explain how can we execute a php script using command line?

585


How to track no of user logged in?

703


Is variable name casesensitive in php?

617


Where is my php ini file?

653


What is a namespace in php?

577


How to support multiple-page forms?

649


What is difference between print_r and echo in php?

579


What is the use of "enctype" attribute in a html form?

604


How error handling is being handled by php?

623


What type of errors can be occurred in php?

650