It's entirely possible that this question already exists on here, I just simply don't have the vocabulary to search for it. That fact probably shows in the question title as well. Here's the question:
The largest size output by the third-party renderer I'm working with is 256 in^2. There are no proscriptions on width and height. So, what I need to calculate is, for all area > 256, the scale that would need to be applied to width and height, retaining the aspect ratio between the two and reducing the area to ~256.
Thanks.
Let $w$ be width and $h$ be height. We want to find a scale factor $s$ such that $$(sw)(sh) = 256.$$ Solving for $s$, we have $$s = \sqrt{\frac{256}{wh}} = \frac{16}{\sqrt{wh}}.$$
And then the scaled width and scaled height are $sw$ and $sh$, respectively.
For example, suppose you are given $w=8.5$ and $h=11$. The formula above says $s=\frac{16}{\sqrt{8.5\cdot11}} \approx 1.655$, so you should scale the width and height by this factor, obtaining a new width and height of $8.5\cdot1.655 = 14.064$ and $11\cdot1.655 = 18.201$ respectively; note that the aspect ratio $$\frac{14.064}{18.201} = \frac{8.5}{11} \approx 77.27\%$$ and that the scaled area $$14.064\cdot 18.201 = 256$$ almost exactly.