View Single Post
Old 13th July 2020, 10:46   #12
Major Dude
Join Date: Mar 2008
Location: Erlangen
Posts: 937
Hi NeonAngel
Good to hear it works now. I don't know why you used "min"; my original code uses "max (sz.x,sz.y)".

I can't pull code like that out of the hat either, but it is not difficult; although some trial and error will certainly be required.
Scaling the image aspect correctly is easy, but that only means the image will be displayed undistorted, not that it will also fit the screen. That would only be the case for images with exactly the same aspect ratio as the screen.

So in a next step we need to scale the image, depending on whether it is too tall or too high. We need a decision, and that is done by max() which simply selects the axis with the largest misfit, and then scales both axes accordingly, maintaining the already corrected aspect.
Nitorami is offline   Reply With Quote