`
java110eye
  • 浏览: 64296 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

JAVA获得图片像素

阅读更多

package cn.net.comsys.sso;

import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.*;

public class Test {
	public static void main(String args[]) {

		File file = new File("a.bmp");
		BufferedImage bi = null;
		try {
			bi = ImageIO.read(file);
		} catch (Exception e) {
			e.printStackTrace();
		}

		int width = bi.getWidth(); // 像素
		int height = bi.getHeight(); // 像素
		System.out.println("width=" + width + ",height=" + height + ".");

	}

}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics