Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

group large set of images

Is there any algorithm for arranging a lot of small images with different dimensions and group them into a larger one? Anyone have any idea from where should i start investigating?


EDIT: Basically i want to make something like this http://www.google.ro/images/srpr/nav_logo27.png in PHP. I'm not really expecting such complexity. I'm gonna use the image as a CSS sprite, if it makes any difference.

like image 559
Quamis Avatar asked Nov 17 '10 12:11

Quamis


People also ask

What is it called when you put a whole bunch of pictures together?

Photomontage is the process and the result of making a composite photograph by cutting, gluing, rearranging and overlapping two or more photographs into a new image.

What is a cluster of pictures called?

In the field of photographic imaging, a photographic mosaic, also known under the term Photomosaic, is a picture (usually a photograph) that has been divided into (usually equal sized) tiled sections, each of which is replaced with another photograph that matches the target photo.

What is image grouping?

Grouping lets you rotate, flip, move, or resize all shapes or objects at the same time as though they were a single shape or object. You can also change the attributes of all of the shapes in a group at one time, such as adding a shape fill or effect, or an effect to a picture.


2 Answers

  • square+packing+algorithm
  • square+packing+problem
  • Packing problem

Generally it is hard computational problem, but approximate solutions exist.

Edit: Related question Packing rectangular image data into a square texture

like image 155
Ross Avatar answered Sep 30 '22 19:09

Ross


Using an optimization algorithm could be an overkill for your problem. Coding an optimization algorithm will require a lot of pre-study. Even implementing a ready library could be a big problem to tackle.

You can devise a heuristic, by yourself:
Use the large image's width and height as your input.
Think of it as if you fill up each row and continue to the next row once the row is filled up. And start inserting images one by one.

If you use an algorithm the final image will be more optimized. Smaller in size. But the difference would not be much different if your images do not vary a lot in dimensions.

If your image dimensions do vary a little, order them according to their most varying dimension (either width or height). Then start inserting the images in that order.

like image 41
Haluk Avatar answered Sep 30 '22 20:09

Haluk