Reputation: 1796
I am using this method to show my BufferedImage
:
public void setUriFromInpustream(InputStream in) {
BufferedImage bimg;
try {
bimg = ImageIO.read(in);
originAspectRatio = (double) bimg.getWidth() / (double) bimg.getHeight();
if (width == 0)
width = bimg.getWidth();
if (height == 0)
height = bimg.getHeight();
setPreserveOriginAspectRatio(preserveOriginAspectRatio);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
And the bimg.getWidth()
and bimg.getHeight()
is showing me NullPointerException
.
Any solution?
Upvotes: 0
Views: 364