wayneh
Aug 28th, 2007, 02:15 PM
I'm trying to find a way to automatically determine the best paper size to print a file onto.
Assume you have a list of 2 dimensional paper sizes.
Then given a 2 dimensional image size, find the best paper fit, where "best"
means the smallest paper the image can fit on. Rotation is acceptable - meaning the dimensions can be swapped x <-> y if they give the best fit.
So, given an image 5x9, a page that is 10x5 is acceptable if no other fit is better.
Also assume the list may contain repeats and swapped dimensions.
For example:
image: 209 x 280
available sizes:
1: 215 x 279
2: 279 x 431
3: 431 x 279
4: 215 x 355
5: 184 x 266
6: 297 x 420
7: 210 x 297
8: 165 x 131
9: 190 x 254
In this scenario 2,3, 4, 6 and 7 all would work, but 7 is the "best fit".
1, 5, 8 and 9 are too small.
Does anyone know of an algorithm to calculate this?
Thanks.
Assume you have a list of 2 dimensional paper sizes.
Then given a 2 dimensional image size, find the best paper fit, where "best"
means the smallest paper the image can fit on. Rotation is acceptable - meaning the dimensions can be swapped x <-> y if they give the best fit.
So, given an image 5x9, a page that is 10x5 is acceptable if no other fit is better.
Also assume the list may contain repeats and swapped dimensions.
For example:
image: 209 x 280
available sizes:
1: 215 x 279
2: 279 x 431
3: 431 x 279
4: 215 x 355
5: 184 x 266
6: 297 x 420
7: 210 x 297
8: 165 x 131
9: 190 x 254
In this scenario 2,3, 4, 6 and 7 all would work, but 7 is the "best fit".
1, 5, 8 and 9 are too small.
Does anyone know of an algorithm to calculate this?
Thanks.