PHP imagecolordeallocate - Deallocate a color for an image
imagecolordeallocate — Deallocates a color for an image.
Syntax
bool imagecolordeallocate ( resource $image , int $color )
The imagecolordeallocate() function deallocates the previouslyimagecolorallocate()orimagecolorallocatealpha()allocated color.
Examples
<?php
header("Content-type: image/png");
$im = @imagecreate(100, 50)
or die("不能初始化新的 GD 图像流");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagecolordeallocate($im, $background_color);
imagepng($im);
imagedestroy($im);
?>
The output image of the above example is shown below:
Related Articles
- imagecolorallocate()Allocate a color for an image.
- imagecolorallocatealpha()Allocate a color and transparency for an image.
PHP Image Processing