fixed resize_image for the case of constant images