update image function