你必须给你的以下信息:
width = 1920
height = 1080
area = 2073600
ratio = width/height =~ 1.77778
现在,假设例如你希望在区域缩小到现在的规模的25%来计算新的宽度和高度。那好吧,我们知道以下几点:
area = 0.25 * 2073600 = 518400
height = h (Variable, because it is unknown at the moment)
width = w (Variable, because it is unknown at the moment)
ratio = 1.77778 (Ratio should stay the same or image becomes warped/stretched)
所以,你必须
w/h = 1.77778 (Your unknown new width divided by unknown height equals ratio)
w * h = 518400 (Your unknown width times unknown height equals area)
现在你可以解决它相对容易数学。它只是两个有两个变量的方程。
w = 1.77778 * h (from first equation)
(1.77778 * h) * h) = 518400 (by plugging above into second equation)
h =~ 540
w =~ 960
这有道理吗?
来源
2013-07-04 21:53:19
Kon
我不能甚至说多少我感谢你! –
没问题,很高兴我能帮上忙。 – Kon