ある画像(img_A)がimagecolortransparentを使っても変化が無かった。



この機能はTrueColorイメージにしか対応して無いみたい;



なので



imagecreatetruecolorでimg_Aと同じサイズのTrueColorイメージを作成して、

imagecopyresampledでさっきのTrueColorイメージとimg_Aを合成してTrueColorイメージにする。



元画像 $img_A

$x = imagesx(img_A);

$y = imagesy(img_A);

$img_B = imagecreatetruecolor($x,$y);

imagecopyresampled($img_B,$img_A,0,0,0,0,$x,$y,$x,$y);

imagedestroy($img_A);



でimg_Bがimg_Aを元にコピーされたTrueColorイメージに。



$kuro = imagecolorallocate(0,0,0);

imagecolortransparent($img_B,$kuro);



で黒が透明になる。



バグなのかどうか知らないけど、黒しか透過できない;

知ってる人いたらおせ~て~