Change CalculateDesiredDimensions() to consider the image aspect ratio