Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
