Semi transparent picture in picture

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
GrassHopper

Semi transparent picture in picture

Post by GrassHopper » 2006-02-13T02:53:42-07:00

Hi,
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");
this is code of same in magickwand but without that transparency

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");
Can you help me? Thanks...

GrassHopper

Post by GrassHopper » 2006-02-16T04:09:51-07:00

Is it possible at last? I think, that so basic function must be included :(
please help if you can :(

Post Reply