Search code examples
phpimagemagickimagick

Imagick combine images


I use Imagick to combine few images into one, here is code:

foreach($this->images as $image) {
    $stack->addImage($image['imagick']);
}

$montage = $stack->montageImage(new ImagickDraw(), $placing, $this->resultWidth."x".$this->resultHeight, 0, 0);
$montage->writeImage($result);

i getting this http://prntscr.com/b54uwe

i'm trying to connect 2 images 1 and 2, also i need help, how to combine images withouw whitespaces between them?


Solution

  • how to combine images withouw whitespaces between them?

    The thumbnail_geometry should contain the width/height and offset (e.g. WxH+L+T).

    To eliminate the whitespace, the third parameter would be ...

    $stack->montageImage(new ImagickDraw(),
                         $placing,
                         $this->resultWidth.'x'.$this->resultHeight.'+0+0',
                         0,
                         0);