I am printing panoramas with aspect ratios between 1.7:1 and 8:1. A common case is an image which scales to 18" x 8" leaving 4 inches on a standard 12x18 inch page. Paper only comes in so many sizes, but my images can be almost any size.
I hate to waste a 4x18 inch print space and I have been eyeballing other stock images which can be scaled to fill up most of the room with minimal whitespace or distortion. I just put my website and copyright on them and use them as business cards.
Every time I do a print job, I have to find new, creative combinations. It seems as though somebody has already skinned this cat. I have searched for a few hours and can't find any reference to the algorithm.
I have written a tiny, half-fast (?) script which takes an image file spec and a page size, scales it to fit the page, calculates the whitespace and gives me the aspect ratio of the whitespace. I then look for some stock image with roughly that AR and scale it to fit.
If no single image fits, then I look for 2 which will fit. I have gone as far as to use 3. What a recurring pain.
Why would you spend hours trying to save a couple dollars worth of paper? Some of the prints are fairly high volume and some are printed at 3+ feet so it can add up. Plus, I get free gimmes I can hand out to put real product in peoples' hands.
And, some of the panoramas take up to 34 HDR images, each of which has to be hand Photoshopped to match and each HDR image is usually 7, 36 MPix, D800E images. Yes, it takes as many as 238 individual NEF files and trillions of CPU cycles to make one gigantic panorama.
I already have many hours invested in each picture, and once I make a packed master, I can use it from then on, scaling to fit. Converting ~30% waste into useful product adds directly to the bottom line.
Once the grunt calculations and combinations are done, it would be quite easy to use ImageMagick to scale them on the fly and flash them in front of you so you could pick the one you like best. It could be entertaining.
Most importantly, it is an intellectual challenge, a good solution of which has so far eluded me.
Any ideas?