PHP imagecolortransparent - 將某個顏色定義為透明色

PHP 圖像處理PHP 圖像處理

imagecolortransparent — 將某個顏色定義為透明色。

語法

int imagecolortransparent ( resource $image [, int $color ] )

imagecolortransparent() 將 image 圖像中的透明色設定為 color。image 是 imagecreatetruecolor() 返回的圖像識別字,color 是 imagecolorallocate() 返回的顏色識別字。

注意:透明色是圖像的一種屬性,透明度不是顏色的屬性。一旦設定了某個顏色為透明色,圖像中之前畫為該色的任何區域都成為透明的。

返回新透明色的識別字,如果省略 color 則返回當前透明色的識別字。

注意:透明度僅能通過 imagecopymerge() 和真彩色圖像拷貝,不能用 imagecopy() 或調色板圖像。

PHP 圖像處理PHP 圖像處理