Identifies images and handles invalid images.