How to resize an image while maintaining its original aspect ratio?
What exactly i want to do I want to fit an image to an arrangement but the million dollar question is, how can I do so while maintaining the original aspect ratio of the image?
How to resize an image while maintaining its original aspect ratio?
What exactly i want to do I want to fit an image to an arrangement but the million dollar question is, how can I do so while maintaining the original aspect ratio of the image?
If you are placing the image into a horizontal component, set image’s height to fill parent and width to automatic. If you are placing the image into a vertical component,set image’s width to fill parent and height to automatic. This is what I usually do. Let me know if this works!
This is not what I am talking about… I said about while resizing or stretching.
So you are not placing the image into an arrangement ( horizontal/vertical)?
Not working at all , works in my device , not working in my friend mobile
try the image extension and its Scale method together with the scaling logic CROP
https://puravidaapps.com/image.php
Taifun
To keep the aspect ratio of an image being stretched, you have to use the following formula:
First give the component any new width, either by app calculations or by user input.
Then use that new width in this formula:
NewHeight = (OriginalHeight / OriginalWidth) x NewWidth
This will keep the image from looking distorted when changing it’s size.
Also, you can reverse the width and height if you need to calculate it by a new height instead.