You need to be sure the image has been loaded before trying to use it. The getImage starts reading the image and returns before it is fully read. The ImageIO class doesn't return until the image is...