java 如何获取图片的像素值

如题所述

第1个回答  2013-08-06
try{
File _file = new File("C:/Documents and Settings/mayuanfei/My Documents/女友照片.jpg"); //读入文件
Image src = javax.imageio.ImageIO.read(_file); //构造Image对象
int wideth=src.getWidth(null); //得到源图宽
int height=src.getHeight(null); //得到源图长
System.out.println(wideth+","+height);
}catch(Exception e){
e.printStackTrace();
}本回答被网友采纳
相似回答