Proportional scaling of rectangular objects
Calculation proof for scaling images, with a quadratic destination image and different sized source images.
Thesis
destination image size: $dest_width = 360 = $new_width, $dest_height = 360 (ie. quadratic), scaling is always done with the width
source image size: $source_width / $source_height = $source_aspect_ratio
calculation: $new_width / $source_aspect_ratio = $new_height
Notes
eg. width: 360, height = 360 (ball.svg), but auto.svg is more like 600 width, 150 height ⇒ 600 / 150 = 4 = $source_aspect_ratio (= seitenverhältnis)
eg. width 200, height 400, ie. 200 / 400 = 0.5
⇒ (new_width = 360) / ($source_aspect_ratio = 0.5) = 720 ⇒ new_height