I have a device that has an HDMI connector and can output to monitor and I have the image that I need to be displayed at the center of the screen as big as possible while keeping its aspect ratio. The device can output a picture that is 1920 by 1080 and the image has resolution 640 by 480.

Effectively we need to find a single ratio that we will multiply the width and height of that image and that image will fill the whole vertical or horizontal space. It must be a single ratio because we need to keep the aspect ratio of the image and not stretch or shrink it in a single dimension.

Firstly, we divide 1920