我有兩個圖像。我將 imageA 放在 imageB 上。然而,這導致底部圖像 (imageB) 顏色不顯示。相反,imageA 的透明部分覆蓋了 imageB。$dest = imagecreatefrompng(6.png'); (96x96)$src = imagecreatefrompng(5.png');imagealphablending($dest, true);imagesavealpha($dest, true);imagealphablending($src, true);imagesavealpha($src, true);imagecopy($dest, $src, 10, 30, 0, 0, 40, 40);ob_start();imagepng($dest);$imgswap = ob_get_clean();imagedestroy($dest);正如您所看到的,透明(為了清晰起見,在本例中為白色像素)越過 marios 臉。有任何想法嗎?
1 回答

達令說
TA貢獻1821條經驗 獲得超6個贊
來自文檔(https://www.php.net/manual/en/function.imagecolortransparent.php):“僅使用 imagecopymerge() 和真彩色圖像復制透明度,而不使用 imagecopy() 或調色板圖像。”
嘗試:https://www.php.net/manual/en/function.imagecopymerge.php即使它在評論中說它不支持 aplha。
- 1 回答
- 0 關注
- 169 瀏覽
添加回答
舉報
0/150
提交
取消