2
투명 이미지를 만들고 이미지 품질을 유지하면서 투명한 png를 결합해야합니다.어떻게 투명 캔버스를 만든 다음 투명 PNG를 추가합니까?
어떻게하면됩니까?
imagecreatetruecolor(...);
//processing using imagecopymerge(..);
imagepng(...);
은 검은 색 배경을 출력합니다.
감사합니다 :)
여기 참조 내 실제 코드의 ...
$d = getimagesize(TMP.$this->files[0]);
$source_height = $d[0];
$source_width = $d[1];
$this->canvas = imagecreatetruecolor($source_width*count($this->files),$source_height);
imagealphablending($this->canvas, false);
$i=0;
foreach($this->files as $f){
$dst_x = $source_width*$i;
$im = imagecreatefrompng(TMP.$f);
imagecopyresampled ( $this->canvas , $im ,
$dst_x ,
$dst_y = 0 ,
$src_x = 0 ,
$src_y = 0 ,
$source_width ,
$source_height ,
$source_width ,
$source_height);
$i++;
imagepng($im,TMP.$i.".png");
if($i>3)break;
}
$fn = TMP."stiched_up_$i*$source_width.png";
imagesavealpha($this->canvas,TRUE);
imagepng($this->canvas,$fn);
가능한 중복 [2-3 투명 PNG를 결합 PHP를 사용하여 서로의 위에 이미지] (http://stackoverflow.com/questions/1397377/combine-2-3-transparent-png-images-on-top-of-each-other-with-php) – Artefacto
거의, png 이미지로 시작하여 png 이미지를 작성한 후 추가해야합니다. – significance
이미지를 만들 든 기존 이미지에 추가하든 대답은 동일합니다. +1에 대해 중복. – Wrikken