using montageImage?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
pwnedd
Posts: 35
Joined: 2008-09-03T13:03:57-07:00

using montageImage?

Post 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
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: using montageImage?

Post by mkoppanen »

Mikko Koppanen
My blog: http://valokuva.org
pwnedd
Posts: 35
Joined: 2008-09-03T13:03:57-07:00

Re: using montageImage?

Post 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
Post Reply