dealing with an edge case when input image is small.