This calculates the maximum possible image size without changing the ratio
github.com/1Euro7Cent/ImageMaxSize
1Euro7Cent/ImageMaxSize