進出口面臨的一個奇怪的問題,當我使用imagemagik轉換的圖像用PHP imagecopy的。這裏是我的代碼Imagemagik和PHP imagecopy的不保留透明度
$cmd = "convert ".realpath($temp1)." -alpha set -channel alpha -background none -vignette 0x3 ".$dest_img;
exec($cmd);
這段代碼的邊緣羽化,所以我可以有一個乾淨的合併。這裏是我的影像融合
$image = imagecreatefromjpeg($postcard_img);
$frame = imagecreatefrompng($thumb_img);
list($w, $h) = getimagesize($postcard_img);
imagealphablending($frame,true);
//imagecopymerge($image, $frame, $coords[0], $coords[1], 0, 0, $w, $h, 100);
imagecopy($image, $frame, $coords[0], $coords[1], 0, 0, $w, $h);
代碼這裏是結果
現在沒事了奇怪的東西..如果我不使用ImageMagik和簡單地更換與imagecopymerge(imagecopy的()進行合併),它的工作原理,然後但留下粗糙的邊緣。這裏是)imagecopymerge的代碼(
$postcard_img = $postcard[0]["ms_filepath"].$postcard[0]["ms_filename"];
$thumb_img = $thumb[0]["ms_thumbpath"].$thumb[0]["ms_thumbname"];
$image = imagecreatefromjpeg($postcard_img);
$frame = imagecreatefrompng($thumb_img);
list($w, $h) = getimagesize($postcard_img);
imagealphablending($frame,true);
imagecopymerge($image, $frame, $coords[0], $coords[1], 0, 0, $w, $h, 100);
這裏是結果(見粗糙的邊緣)
所有我需要的是有羽毛的形象。任何想法,爲什麼它的發生,以及如何克服呢?
爲什麼不使用Imagemagick處理所有事情? – 2012-03-28 19:17:58
是的,我想要走你的路,但除了imagemagik以外沒有其他辦法嗎? – casper123 2012-03-28 20:12:30