views:

28

answers:

1

How can i create a collage from a large number of images as per below using PHP scripts?

I am also looking at creating different sizes A0, A1, A2 sized images depending on the number of pictures used in the collage.

alt text

Thanks

+1  A: 

I suggest using Imagemagick. There are some excellent tutorials on Mikko's blog:

http://valokuva.org/?cat=1

Take a look at the Polaroid example, here:

http://valokuva.org/?p=37

The Reflection tutorial demonstrates how to create composite images:

http://valokuva.org/?p=82

EDIT

Here's a few more useful links:

Image Processing (ImageMagick)
http://php.net/manual/en/book.imagick.php

Imagick::readImageFile
http://www.php.net/manual/en/function.imagick-readimagefile.php

Imagick::rotateImage
http://www.php.net/manual/en/function.imagick-rotateimage.php

Imagick::scaleImage
http://www.php.net/manual/en/function.imagick-scaleimage.php

PHPro Tutorial
http://www.phpro.org/tutorials/Imagick.html

And finally...

This one is a good starting point:

Programmed Positioning of Layered Images
http://www.imagemagick.org/Usage/layers/#example

Mike
Thanks Mike, is there any open source component that generates images as above based on a set of input images? Or anything even close?
ToughPal
I'm not aware of anything that you could get 'off the shelf', but perhaps somebody has already written something similar. I don't know how you would begin searching for such a utility. I don't think writing something in PHP would be *too* difficult. The ImageMagick library web site has all manner of examples, including compositing examples (http://www.imagemagick.org/Usage/compose/). I'd do something like: read each image, scale it, rotate it to a random angle, place it at a random position on the output drawing. The hard part will probably be making something that fills the area properly.
Mike