PHP imagecolorexactalpha - Get the Index of the Specified Color Plus Transparency
imagecolorexactalpha — Gets the index value of the specified color plus transparency.
Syntax
int imagecolorexactalpha ( resource $image , int $red , int $green , int $blue , int $alpha )
Returns the index value of the specified color plus transparency in the image palette.
**Note:** This function requires GD 2.0.1 or higher (2.0.28 or higher recommended).
Parameters
- image The image resource returned by an image creation function (e.g., imagecreatetruecolor()).
- red The value of the red component.
- green The value of the green component.
- blue The value of the blue component.
- alpha A value between 0 and 127. 0 means fully opaque, 127 means fully transparent.
The color parameter is an integer between 0 and 255, or a hexadecimal number between 0x00 and 0xFF.
Return Value
Returns the index value of the specified color plus transparency in the image palette. Returns -1 if the color is not in the image palette.
Example
Get the color from the Runoob Tutorial logo.
The output of the example above is similar to:
Array
(
[0] => 16711680
[1] => 2130706432
[2] => 939524095
[3] => 342163252
)
Related Articles
- imagecolorclosestalpha() Get the color closest to the specified color plus transparency.
PHP Image Processing