简体   繁体   English

背景变黑了

[英]Background is turning out black

I have done everything I could possibly try to fix this. 我做了一切我可能尝试解决的问题。 I've spent over an hour researching and trying code, but nothing has helped. 我花了一个多小时研究和尝试代码,但没有任何帮助。

This code does the following. 此代码执行以下操作。

  • Take two completely-white images and re-color them ( while keeping transparency ) 拍摄两张完全白色的图像并重新着色( 同时保持透明度
  • Merge the two images together 将两个图像合并在一起
  • Outputs the images (but with a black background!!) 输出图像(但一个黑色的背景!)

Can someone help identify and patch the part that's causing the black background? 有人可以帮助识别和修补导致黑色背景的部分吗? See the following URL for an example of the script. 有关脚本的示例,请参阅以下URL。

Set imagealphablending to false, fill your image with a transparent color, set imagealphablending to true, then do your copying stuff. imagealphablending设置为false,用透明色填充图像,将imagealphablending设置为true,然后复制。

$final_image = imagecreatetruecolor($dimensions, $dimensions);
imagealphablending($final_image, false);
$transparency = imagecolorallocatealpha($final_image,  0, 0, 0, 127);
imagefilledrectangle($final_image, 0, 0, $dimensions, $dimensions, $transparency);
imagesavealpha($final_image, true);
imagealphablending($final_image, true);

// rest of the code

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM