Error handling for Image library