私は、他の画像から動的な画像を単純に作成する一種のシステムを構築しています。私は次を使用します:imagecreatefromstring(file_get_contents("clown_avatar.png"));
画像を作成して正常に出力します。ただし、透明領域のすべての色が台無しになります。
元の画像をチェックしてください:
そして、これが PHP ファイルの結果です。
ソースは次のとおりです。数行だけです。
<?php
$im = imagecreatefromstring(file_get_contents("clown_avatar.png"));
//$bg = imagecolorallocate($im,0,0,0); doesn't effect
Header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
背景色を追加しようとしましたimagecolorallocate
; しかし、それはまったく効果がありませんでした。