2017-08-06 7 views
0

私は初心者で次の問題に直面しています。 imagemagick apiで2つのイメージファイルをマージする必要があります - >私はphpを使用しています。 imagemagick(php api)で2つのイメージをマージする方法

私はBG持っている: enter image description here

そして私は、真ん中に透明部分がある別のイメージがあります はenter image description here

Endresultは次のようになります。 enter image description here

私は希望をもし誰かが私を助けてくれたら、とても感謝しています。私はnumerosの方法でそれを試しましたが、どんな成功もありませんでした。この時

答えて

0

外観は:http://phpimagick.com/Imagick/mergeImageLayers

私はこのようなものは、私が出回っ、このいずれかを試してみました

function mergeImages() 
{ 
    // you should find the correct layerMethodType by yourself, 
    // here the available ones: http://php.net/manual/en/imagick.constants.php 

    $layerMethodType = imagick::LAYERMETHOD_COMPARECLEAR; 
    $img1 = new \Imagick(realpath("bg.png")); 

    $img2 = new \Imagick(realpath("play.png")); 
    $img1->addImage($img2); 
    $img1->setImageFormat('png'); 

    $result = $img1->mergeImageLayers($layerMethodType); 
    header("Content-Type: image/png"); 

    echo $result->getImageBlob(); 
} 
+0

Thxを動作するはずだと思います。出力/画像もなくエラーもありません。このコードを私の側に追加すると、私は結果を見るべきでしょうか? – Jakob

+0

これは現在稼働しています – Jakob

関連する問題