Update image resizing to handle constrain better.