# How to convert ratios

I have a camera that returns an image with a 4:3 aspect ratio, while the dimensions of its preview are 16:9.

What math would I need to apply to crop the 4:3 photo to 16:9 ?

If the image has size $\,w \cdot h\,$ then a crop $\,w' \cdot h'\,$ must satisfy $\,w' \le w\,$ and $\,h' \le h\,$.
With $\,w:h = 4:3\,$ and $\,w':h'=16:9\,$, this implies $\,h' = \dfrac{9}{16}w' \,\le\, \dfrac{9}{16}w = \dfrac{9}{16} \cdot \dfrac{4}{3}\,h = \dfrac{3}{4} h\,$.
The maximum size crop is achieved when $\,w'=w\,$, and in that case $\,h'=\dfrac{3}{4}h=\dfrac{9}{16}w\,$.