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
imagecolorresolvealpha() function in PHP
The imagecolorresolvealpha() function is used to get the index of the specified color with alpha.
Syntax
imagecolorresolvealpha (img , red , green , blue , alpha )
Parameters
img: Creates an image with imagecreatetruecolor().
red: The red component
green: The green component
blue: The blue component
alpha: Value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
Return
The imagecolorresolvealpha() function returns the color index.
Example
The following is an example
<?php
$img = imagecreatefromgif('https://www.tutorialspoint.com/images/html.gif');
$colors = array();
$colors[] = imagecolorresolvealpha($img, 120, 0, 190,0);
$colors[] = imagecolorresolvealpha($img, 110, 0, 140,0);
$colors[] = imagecolorresolvealpha($img, 120, 190, 0,0);
print_r($colors);
imagedestroy($img);
?>
Output
The following is the output:
Array ( [0] => 128 [1] => 129 [2] => 130 )
Advertisements
