I have got two pictures. One is named background and second foreground for example...
I want to copy foreground to background and set foreground transparency. But I don't know, how can I do this. In ImageMagick throught cmd line is it easy, but I can't find solution for magickwand.
this is functional example for imagemagick. Watch for -dissolve parameter:
Code: Select all
//imagemagick rotate and resize included picture
exec(convert.exe -rotate 90 -resize 200 x 200 $picture->name temp_$picture->name");
//imagemagick include picutre, set his position and transparency
exec(composite.exe -dissolve 50% -geometry $picture->picturePosX$picture->picturePosY \ temp_$picture->name temp_background.jpg temp.jpg");
Code: Select all
$foreground = NewMagickWand();
$background = NewMagickWand();
MagickReadImage($foreground, "$picture->path/$picture->name");
MagickReadImage($background, "$picture->path/".$session."_temp_background.jpg");
MagickRotateImage($foreground, "", $picture->rotation);
MagickResizeImage($foreground, $picture->new_pictureWidth, $picture->new_pictureHeight, MW_PointFilter, 0);
MagickCompositeImage($background, $foreground, MW_DissolveCompositeOp, $picture->picturePosX, $picture->picturePosY);
MagickWriteImage($background, "$picture->path/".$session."_temp.jpg");