Work is amazingly busy right now, but I wanted to take a break to talk about collages.
So I had this freelance client who wanted a brochure done, full of artwork he’s selling. And on the cover of the brochure, he wanted a collage of 12 of his favorite images.
And I thought to myself, yikes, this is going to be tough.
I had to fit all these differently sized images together in such a way that:
- There is no whitespace between the images.
- The images do not overlap.
- The images should retain their original proportions as closely as possible, with a minimum of cropping.
- The silhouette of the whole composition has to be a smooth rectangle with set proportions that the client wanted, so that a sidebar with informational text would fit nicely beside the collage.
I really didn’t know how to begin. I figured it would be like putting a Tangram together, finding that one, perfect combination of puzzle pieces that would yield a perfect square in the end.
I rather dislike those kinds of puzzles. You’re just guessing. If your guess is wrong, you haven’t made much progress; you just have to guess again and rearrange your pieces.
I started by just randomly sticking images together, and rearranging them, and resizing everything, and got very frustrated.
I started to wonder if if solution existed at all. I mean, really, what are the odds, given a random set of rectangles, that you’d be able to find an arrangement of them that would fit my constraints? They’re totally random. If I gave you a random set of pieces from multiple, different-sized Tangram sets, what are the odds that you’d be able to arrange them all into a square? Pretty slim.
But really, it wasn’t that hard once I figured out that this problem wasn’t nearly as complex as I thought it was.
Given any number of arbitrarily sized and proportioned images, you can proportionally scale them and put them all touching in a row so that their heights are all the same, like a & c below. Or you can put them in a column with all their widths the same, like b, d & e. And the result is another smooth rectangle.
Similarly, you can take any number of image columns or rows, and you can scale them and put them side by side or in vertical stacks and get another rectangular arrangement of images.
And you just keep doing this until you run out of images.
If you don’t like what you’ve got, it’s easy enough to start over. And the images don’t overlap, they retain their original proportions, and you end up with a smooth rectangular collage, and you’re guaranteed to be able to do this with any set of images.
So much for randomness.