As a result, I decided to resize the image before sending it to the user interface. In other words, I do some calculations where, if the image is larger than 500, I then look if it is height or width, and then use what is the largest as the baseline. Then I multiply the aspect ratio to a different size and convert the image accordingly.
So, for example, if I have an image that is 800x600, I then assume that 800 is used as the baseline, which means that 500/800 means that the image should be reduced to 62.5% of its size. Then I reduce 600 by 62.5%, as in 600 * 0.625 = 375. Therefore, I resize the image using my image library to 500x375. And if the image was 600x800, I would resize it to 375x500. In other words, I pre-process the image and rely on something in the GUI to manage this for me.
Stephane grenier
source share