Adds error handling to skip images that fail instead of crash.