Ratio's and Max Size

65 Views Asked by At

If I have a video of size:

 width: 640
 height: 480

and a screen of size:

 width: 1280
 height: 720

what is the equation to find the max width and height I can stretch the video too and keep its ratio.

I can calculate the ratio like:

 ratio = width / height

 video ratio: 1.3

 screen ratio: 1.7

that's about as far as I can work out :-(

2

There are 2 best solutions below

2
On BEST ANSWER

Divide the corresponding measurements by each other: screen width by video width, screen height by video height. Then take the smaller of the two ratios, and that's the amount you can stretch the video by.

In this example, we have $$\frac{\text{screen width}}{\text{video width}} = \frac{1280}{640} = 2$$ $$\frac{\text{screen height}}{\text{video height}} = \frac{720}{480} = 1.5$$ So you can stretch the video by a factor of $1.5$, making it $960\times720.$

0
On

Since the ratio of the widths is 2 and the ratio of the heights is 1.5, you can stretch the video by a factor of $\min(1.5,2)=1.5$ and it will still fit on the screen. If you scale it up by a larger factor it will be too large in the vertical dimension.