InputStream is = new FileInputStream(filename);//通过文件名称读取
或
InputStream is =new ByteArrayInputStream(byte[] a);//通过文件的字节数组读取
BufferedImage buff = ImageIO.read(is);
buff.getWidth(); //得到图片的宽度
buff.getHeight(); //得到图片的高度
is.close(); //关闭Stream
InputStream is = new FileInputStream(filename);//通过文件名称读取
或
InputStream is =new ByteArrayInputStream(byte[] a);//通过文件的字节数组读取
BufferedImage buff = ImageIO.read(is);
buff.getWidth(); //得到图片的宽度
buff.getHeight(); //得到图片的高度
is.close(); //关闭Stream