Added exception handling for if the image file fails to open