Keep Image Aspect Ratio
Posted: Sat May 03, 2014 11:52 am
Hello,
I have a stack that uses an image object. The user is able to select an image from a list, and the image is loaded up into the image control through the fileName property.
However, when the fileName is set the the image path, the size and width of the image control change, causing it to cover up objects on the card. To solve this I locked the image control's width and height. Now when loaded, images appear stretched, as they are being set the the specified width and height.
What I want is the image to maintain its aspect ratio, without changing the size of the image control. This would mean that there would be blank spaces on the edges of the image control.
Does anyone know how to do this?
Thanks,
Andrew
I have a stack that uses an image object. The user is able to select an image from a list, and the image is loaded up into the image control through the fileName property.
However, when the fileName is set the the image path, the size and width of the image control change, causing it to cover up objects on the card. To solve this I locked the image control's width and height. Now when loaded, images appear stretched, as they are being set the the specified width and height.
What I want is the image to maintain its aspect ratio, without changing the size of the image control. This would mean that there would be blank spaces on the edges of the image control.
Does anyone know how to do this?
Thanks,
Andrew