LoginSignup
0
0

More than 5 years have passed since last update.

アスペクト比の計算方法

Posted at

ディスプレイ幅:1024
ディスプレイ高:720
画像幅:960
画像高:540

幅比率=ディスプレイ幅 / 画像幅
高比率=ディスプレイ高 / 画像高
比率=min(幅比率,高比率)

比率適用後の画像幅 = 画像幅 * 比率
比率適用後の画像高さ = 画像高 * 比率

1024 x 720
960x 540

x = 1024 / 960 = 1.066666666666667
y = 720 / 540 = 1.333333333333333

min(x, y) = 1.066666666666667

960 * 1.066666666666667
540 + 1.066666666666667

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0