通過Java獲取圖片的信息
阿新 • • 發佈:2017-09-29
edi 取圖 out print ring str public ioe ack
1. 圖片:96 * 96
2. 程序如下:
package com.bnc.bufferedImage; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import javax.imageio.ImageIO; public class TestBufferedImage { public staticvoid main(String[] args) throws FileNotFoundException, IOException { BufferedImage image = ImageIO.read(new FileInputStream("D:/1230/logo_img_admin.png")); int width = image.getWidth(); int height = image.getHeight(); System.out.println("width:"+width); System.out.println("height:"+height); } }
3. 輸出結果如下:
通過Java獲取圖片的信息