title: Resize an image so that the size matches a specified aspect ratio
body: <p>I am working on a problem where I need to resize an image to a specific aspect ratio. I am not able to think of any solution. I am sharing a sample image with a processed image from pixelz.
  For example, the input image size is 1833 x 2133 and it gets resized to 1623 x 2164, which is a 3:4 ratio. The output image size is not fixed could be any nearest size with a 3:4 ratio.</p>
  <p>Maybe we could approach it by finding the nearest number pair that has a 3:4 ratio.</p>
  <p><a href="https://i.stack.imgur.com/NCtOo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NCtOo.jpg" alt="enter image description here" /></a></p>