Page 1 of 1

using montageImage?

Posted: 2008-09-03T13:11:42-07:00
by pwnedd
Hi all,

I'm just get started out with Imagick, and had a question about the montageImage function. I want to stitch together four tiles to create a single image. I can do this fine on the command line

Code: Select all

montage 1 2 3 4 -geometry +0+0 montage.jpg
but have not had any luck doing it with PHP. The code I came up with so far is:

Code: Select all

$tiles = new Imagick(glob('images/*.jpg'));
$tiles->montageImage(new imagickdraw(), "2x2+0+0", "512x512+0+0", imagick::MONTAGEMODE_CONCATENATE, "0x0+0+0");

//output
header( "Content-Type: image/jpg" );
echo $tiles;
But that only shows one tiles. Anyone know what I'm doing wrong? Any help would be greatly appreciated.

Thanks!
Keith

Re: using montageImage?

Posted: 2008-09-03T13:52:45-07:00
by mkoppanen

Re: using montageImage?

Posted: 2008-09-04T06:14:45-07:00
by pwnedd
Hey Mikko,

Thanks for the reply. The example was just what I was looking for :)

I have a couple questions about your example:

1. Why did you use 3x4+0+0 for tile_geometry when you only have nine images? Also, what is the second half of the tile geometry used for?

2. What is the difference between MONTAGEMODE_UNFRAME and MONTAGEMODE_CONCATENATE?


Your blog is really great. I actually came across it yesterday for the first time when I was trying to find some more documentation on Imagick
and subscribed. I was even getting ready to ask you there in a comment thread, but decided it would be more appropriate to ask on a forum
than to harass you on your blog.

Appreciate the help.

Take care!
Keith