How can I find the colour of a pixel of an image?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
How do you match the character ^ at the beginning of the string? - ^^
Do you know what are traits?
i am a php programmer can i be a java programmer?
What does $globals mean?
Explain the difference between require() and require_once()?
How can I embed a java programme in PHP file and what changes have to be done in PHP.ini file?
1 Answers Sify, Small Biz Express,
How to print \ in php. Only \ with out using . or *.
Write a function that takes "depth" as argument and return sum of node's data of that depth. For instance, (0) depth 0 / \ (10) (20) depth 1 / \ (40) (50) depth2 If I pass get_sum_by_depth(2) , it would return 90 (i.e. 40 + 50 )
What are PHP Magic Methods/Functions. List them.
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
Can we use include (?abc.PHP?) two times in a PHP page ?makeit.PHP??
Which is correct about mysqli and pdo?