Latest web development tutorials

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

PHP 圖像處理 PHP圖像處理

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

語法

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

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

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

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

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

PHP 圖像處理 PHP圖像處理