imagecolorallocate() function in PHP

The imagecolorallocate() function allocates a color for an image.

Syntax

int imagecolorallocate ( $img, $red, $green, $blue )

Parameters

  • img: Image resource created with imagecreatetruecolor().

  • red: Red color component

  • green: Green color component

  • blue: Blue color component

Return

The imagecolorallocate() function returns a color in RGB format.

Example

The following is an example:

Output

The following is the output:

Updated on: 2019-12-31T07:21:19+05:30

627 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements