Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

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

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

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

Post New Answer

More PHP Interview Questions

Define urlencode() and urldecode() used in php?

0 Answers  


Explain do you use composer? If yes, what benefits have you found in it?

0 Answers  


Explain difference between urlencode and urldecode?

0 Answers  


What are php magic methods/functions?

0 Answers  


Is php a middleware?

0 Answers  


What percentage of websites use php?

0 Answers  


What is namespaces in PHP?

0 Answers  


What is session data?

0 Answers  


hi recently i had faced an interview in that they asked me that php have faced the problem of y2k so which one is that year like 2030,2059 not remember exact year anybody will tell me pls?

1 Answers  


How to Define a Constant in PHP? Is $ symbol necessary?

6 Answers   Maples,


Explain what are the two main string operators?

0 Answers  


How can we get second of the current time using date function?

2 Answers   FD, IBM,


Categories