views:

56

answers:

2

Hi.

I need to put many pictures into a sheet (A4) but I need an algorithm to optimize the space used in order to put the maximum numbers of possible images into the sheet.

+4  A: 

That's quite a generic problem... if there are no assumptions at all on the dimensions of the images, your problem is exactly the knapsack algorithm, two-dimensional.

Arthur Reutenauer
A: 

You could try to calculate all combination of the images on the sheet. If this is too time intensive you can begin with the biggest images and then try different positions of the smaller images this should let you calculate a good arrangement in a fairly small amount of time.

Janusz