부분적으로 투명한 이미지를 제대로 작동하지 않습니다imagecopymerge는 불투명 내가 가지고있는 이미지가
w 개미 (병합)이 이미지를 다른 이미지 (두 PNG 이미지를 병합 할 수있는 방법을 알고) 추가하십시오. 무엇이 문제이며 불투명도를 잃지 않고 GD
라이브러리로 어떻게로드 할 수 있습니까?
업데이트
내 목표는 그들 중 일부는 (위의 이미지 같은 다른 불투명도) 알파가 일부 이미지를 병합,하지만 난 그들을 병합 할 때 알파 정보가 손실됩니다.
<?php
$background = imagecreatetruecolor(3508, 2480);
// set background to white
$white = imagecolorallocate($background, 255, 255, 255);
imagefill($background, 0, 0, $white);
$dest = $background;
$items = array(
'cloth-1763-1249' => 'cloth-01.png',
'skin-167-59' => "skin-01.png",
'cheek-2247-1193' => 'cheek-09.png',
'hair-167-59' => 'hair-07.png'
);
foreach ($items as $i => $item) {
$src = imagecreatefrompng($item);
imagealphablending($src, true);
imagesavealpha($src, true);
imagecolortransparent($src, 2130706432);
$src_x = imagesx($src);
$src_y = imagesy($src);
$list = explode('-', $i);
//var_dump($list);
imagecopymerge($dest, $src, intval($list[1]), intval($list[2]), 0, 0, $src_x, $src_y, 100);
imagealphablending($dest, true);
imagesavealpha($dest, true);
}
header('Content-Type: image/png');
imagepng($dest);
tnx 답변만으로 작동하지만 전적으로 문제가 있습니다. 질문을 업데이트합니다. – zhilevan
이유를 알고 계십니까? – zhilevan
내 코드를 편집 할 수있는 기능이있는 경우 – jabbink