PHP imagecolordeallocate - 画像の色の割り当てを解除する

PHP 图像处理PHP 画像処理

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);
?>

上記の例の出力結果の画像は次のとおりです。

関連記事

PHP 图像处理PHP 画像処理

その他の拡張