Composite

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
phyxsius

Composite

Post by phyxsius »

i have a small question.

Code: Select all

$image1 = new Imagick();
$image1->readImage("1.jpg");
$image2 = new Imagick();
$image2->readImage("2.jpg");

$imageDraw = new ImagickDraw();

$imageDraw->composite($COMPOSITE_OVER, 50,50,800,800,$image2);
$imageDraw->render();

$image1->drawImage($imageDraw);
$image1->writeImage("out.jpg);
what am i doing wrong?? out.jpg is identic with 1.jpg :(
how does the composite works??
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Composite

Post by mkoppanen »

phyxsius wrote:i have a small question.

Code: Select all

$image1 = new Imagick();
$image1->readImage("1.jpg");
$image2 = new Imagick();
$image2->readImage("2.jpg");

$imageDraw = new ImagickDraw();

$imageDraw->composite($COMPOSITE_OVER, 50,50,800,800,$image2);
$imageDraw->render();

$image1->drawImage($imageDraw);
$image1->writeImage("out.jpg);
what am i doing wrong?? out.jpg is identic with 1.jpg :(
how does the composite works??

First of all you are using the imagick extension, not the MagickWand extension.

The code should look like:

$image1 = new Imagick();
$image1->readImage("1.jpg");
$image2 = new Imagick();
$image2->readImage("2.jpg");

$image1->compositeImage( $image2, Imagick::COMPOSITE_OVER, 50, 50 );
$image1->writeImage("out.jpg);

Please note that ImageMagick discourse-server is not the place to discuss about the imagick extension.



--
Mikko Koppanen
Mikko Koppanen
My blog: http://valokuva.org
Post Reply