PHP imagecolordeallocate - 取消圖像顏色的分配
imagecolordeallocate — 取消圖像顏色的分配。
語法
bool imagecolordeallocate ( resource $image , int $color )
imagecolordeallocate() 函數取消先前由 imagecolorallocate() 或 imagecolorallocatealpha() 分配的顏色。
實例
<?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);
?>
以上實例輸出結果的圖片如下:
相關文章
- imagecolorallocate() 為一幅圖像分配顏色。
- imagecolorallocatealpha() 為一幅圖像分配顏色和透明度。

PHP 圖像處理