Only rescale an image if either dimension is smaller than window.