The Mathematics of Aspect Ratios
An aspect ratio represents the proportional relationship between a geometric shape's width and its height. It is expressed as two numbers separated by a colon, written as W:H. For example, a standard widescreen layout has a ratio of 16:9, meaning that for every 16 units of width, there are 9 units of height.
To calculate proportional scaling, we use the algebra of ratios. Let W_1 and H_1 be the original width and height of an image, which defines the aspect ratio R:
\R = \W_1/H_1\
If we need to resize the image to a new width W_2 while maintaining the original aspect ratio, the new height H_2 must be computed using cross-multiplication:
\H_2 = W_2 ; times \H_1/W_1 = \W_2/R\
Similarly, if we specify a target height H_2, the scaled width W_2 is calculated as:
\W_2 = H_2 ; times \W_1/H_1 = H_2 ; times R\
To reduce any resolution (such as 1920x1080) to its simplest aspect ratio, we find the Greatest Common Divisor (GCD) of the width and height, denoted as g = \GCD(W_1, H_1). Dividing both dimensions by this divisor yields the simplified integer ratio: (W_1 / g) : (H_1 / g).