Posted on April 24, 2008 by Steve

I downloaded an image having size 1920x1440 that I wanted to use as a desktop. My screen resolution is 1680x1050. To get the aspect ratio right (1.6:1), I cropped the original to 1920x1200 using MS Paint. I then wanted to shrink the image down to fit my desktop, but the resize tool would accept only whole numbers, and I needed to use a factor of 87.5%. I couldn't abide strips on the sides if the result was too small, or the thought that some image would be cut off the edges, or, worst of all, distortion in the image due to a crummy stretch-to-fit.

Some distortion is inevitable in a resize, so I resolved to get my target image size with the minimum number of resizes. How did I do it?

# Comments

What was the image?

------------------

Q: What's the difference between a mathematician, an engineer, and a project manager?

A: A mathematician figures out the formula for the minumum number of required resize operations. An engineer builds a new resize tool that accepts decimals. A project manager resizes to 88% and doesn't worry about the five pixels of the image not being visible along each edge.

------------------

The obvious answer is to stretch it 700% then reduce it to 12.5%. My version of Paint won't stretch by more than 500%, and of course 12.5 is not an integer.

But anyway the obvious answer is stupid because digits to the right of the decimal in the numerator don't matter (as much). So stretch it to 350% then reduce it to 25%.

Shrinking is more destructive, so you want to be sure to do that last.

And what was the image? And which box did you put it on?

------------------

Project Euler has ruined my ability to be satisfied with a practical approximate solution to this kind of problem. I set it up like this:

a/100 * b/100 = 0.875

so a*b = 8750

To find integer solutions for a and b, we get the prime factorization of 8750; 2 * 5 * 5 * 5 * 5 * 7.

This gives the following combinations:

2 * 4375

5 * 1750

7 * 1250

10 * 875

14 * 625

25 * 350

35 * 250

50 * 175

70 * 125

I thought it best to avoid extremes and chose a 125% enlargement followed by a 70% reduction.

The image, for my office desktop, was

one of these.

------------------

------------------