English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP imagecolordeallocate() function usage and example of canceling the allocation of image colors

PHP Image Processing

imagecolordeallocate — Cancel the allocation of image colors.

Syntax

bool imagecolordeallocate ( resource $image , int $color )

The imagecolordeallocate() function cancels the previous allocation by imagecolorallocate() Or imagecolorallocatealpha() Allocated color.

Example

<?php
header("Content-type: image/png
 $im = @imagecreate(100, 50)
     or die("Cannot initialize a new GD image stream");
 $background_color = imagecolorallocate($im, 255, 255, 255); 
 $text_color = imagecolorallocate($im, 233, 14, 91);
 imagestring($im, 1, 5, 5, $text_color);
 imagecolordeallocate($im, $background_color);
 imagepng($im);
 imagedestroy($im);
?>

The image of the output result of the above example is as follows:

Related articles

PHP Image Processing