This causes wide images to appear stretched vertically and tall images to appear stretched horizontally.
Possible solution: Determine if the height or width is the one that would reach the edge first (be fit first) and the opposite dimension is the one that would be stretched, so scale that linearly by the amount that the limiting dimension was scaled, thus preserving the aspect ratio.
This causes wide images to appear stretched vertically and tall images to appear stretched horizontally.
Possible solution: Determine if the height or width is the one that would reach the edge first (be fit first) and the opposite dimension is the one that would be stretched, so scale that linearly by the amount that the limiting dimension was scaled, thus preserving the aspect ratio.