嗨,我有一个绘图图像列表,我只想从它们中获取具有透明背景的绘图...
当前链接到我的图像: Output Image / Input Image
<?php
$path = 'images/test1.png';
$input = imagecreatefrompng($path);
$width = imagesx($input);
$height = imagesy($input);
$output = imagecreatetruecolor($width,$height);
$transparent = imagecolorallocate($output, 0, 0, 0);
//imagealphablending($output, true);
//imagesavealpha($output, true);
imagecopy($output, $input, 10, 10, 0, 0, $width, $height);
imagepng($output,'output.png');
imagedestroy($output);
imagecolortransparent($output, $transparent);
$transparent = imagecolorallocate($output, 0, 0, 0)
?>
谢谢!
答案 0 :(得分:0)
因此有效
<?php
$path = 'images/test1.png';
$input = imagecreatefrompng($path);
$width = imagesx($input);
$height = imagesy($input);
$output = imagecreatetruecolor($width,$height);
$transparent = imagecolorallocate($output, 255, 255, 255);
imagecopy($output, $input, 10, 10, 0, 0, $width, $height);
imagecolortransparent($output, $transparent);
imagepng($output,'images/output.png');
imagedestroy($output);
?>