Added a check to ensure that the image size is correct before attempting to place points.