# How to resize a rectangle to a specific area while maintaining the aspect ratio

Let's just say I have a value like 46,080. I want to resize a rectangular image to have this area while maintaining its aspect ratio. What are some ways I can do that?

Here is an example.

Desired Area = 46,080

image width = 231
image height = 228
image area = 52,668


Decrease the dimensions of the image so it has an area of 46,080 while keeping its aspect ratio.

Let the desired area be $$A$$, and let the current dimensions be $$x$$ and $$y$$. Then, the current area is $$xy$$, so we must scale the area by a factor of $$\displaystyle\frac{A}{xy}$$.

Now, because are is proportional to the square of side length, side length is proportional to the square root of area, so we must scale $$x$$ and $$y$$ by $$\displaystyle\sqrt{\frac{A}{xy}}$$.

Thus, the new dimensions are $$\displaystyle x\cdot \sqrt{\frac{A}{xy}}\text{ by }y\cdot\sqrt{\frac{A}{xy}}$$, equivalent to $$\boxed{\sqrt{\frac{Ax}{y}}\text{ by }\sqrt{\frac{Ay}{x}}.}$$

For your case, just plug in $$A = 46080, x = 231, y = 228$$. You may want to round off the values you find.

• In your approach, does it matter if the image area was less than desired area? Because in my example, its not. Commented Jan 13, 2021 at 3:29
• No, it does not matter. Commented Jan 13, 2021 at 4:24

The aspect ratio $$\frac{231}{228}=1.013157895$$ The area ratio $$\frac{52668}{46080}=0.874914559$$ The area is gets a percentage from both sides so the contribution would be the square root of the area ratio. $$\sqrt{0.874914559}=0.935368676$$ $$231\times 0.935368676=216.070164\\ 228\times 0.935368676=213.264058$$

$$\frac{216.070164}{213.264058}=1.013157895$$

$$216.070164\times 213.264058=46080$$