IANAM (I am not a mathematician) and this is causing me some problems.
I need a function that scales down its input variables based on the min/max range
I want that both width and height are in range AND
originalsize/originalwidth ~= newwidth/newheight
I tried first calculating width, and then decreasing that until width*ratio<=maxheight but that gives result way too low!
Ramses aka x_terminat_or_3