rescale image if width or height is specified in ImageWidget