PHP imagecolordeallocate - Unallocate image colors
Imagecolordeallocate - Cancel the allocation of image colors.
Grammar
bool imagecolordeallocate ( resource $image , int $color )
The imagecolordeallocate() function cancels the color previously assigned by imagecolorallocate() or imagecolorallocatealpha().
Instance
<?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 picture of the output of the above examples is as follows:
Related articles
- Imagecolorallocate() assigns color to an image.
- Imagecolorallocatealpha() assigns color and transparency to an image.