Add function to validate the position of image while the position is out of range of the image