Relative width of one image wrt another

40 Views Asked by At

Suppose I have an image:

120: Original Width
70: Original Height

I have another image:

20: Original Width
20: Original Height

Both these images have to be relative to each other (or should I say these both are in aspect ratio with each other?)

So what would be the height of second image if the height of first image decreases to 100?

Now I do know the way to get aspect ratio with changing height for one single image, which would be (if I am not wrong): Old Width/Old Height * New Width = New Height but how do I apply something like this to two images?

1

There are 1 best solutions below

0
On BEST ANSWER

I'm not sure exactly what you mean by "images have to be relative to each other," but I think what you want is a constant ratio of aspect ratios.

So, your original ratio of aspect ratios is:

$\frac{(120/70)}{(20/20)} = \frac{12}{7}$

You said that the "height of the first image decreases to 100," but I'm going to assume you meant that the height increases to 100. To preserve your aspect ratio, we need to calculate the new height $x$ using:

$\frac{(120/100)}{(20/x)} = \frac{12}{7}$

This leads to $x = \frac{200}{7} = 28.57$.