![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
imagecolorresolve() function in PHP
The imagecolorresolve() function gets the index of the specified color or its closest possible alternative.
Syntax
imagecolorresolve (img , red , green , blue )
Parameters
img: Image created with imagecreatetruecolor() function.
red: The value of red component.
green: The value of green component.
blue: The value of blue component.
Return
The imagecolorresolve() function returns the color index.
Example
The following is an example
<?php $img = imagecreatefromgif('https://www.tutorialspoint.com/images/html.gif'); $colors = array(); $colors[] = imagecolorresolve($img, 120, 0, 190); $colors[] = imagecolorresolve($img, 110, 0, 140); $colors[] = imagecolorresolve($img, 120, 190, 0); print_r($colors); imagedestroy($img); ?>
Output
The following is the output:
Array ( [0] => 128 [1] => 129 [2] => 130 )
Advertisements