现在的位置: 首页 > 综合 > 正文

Android小技巧/获取图片的大小

2018年02月04日 ⁄ 综合 ⁄ 共 258字 ⁄ 字号 评论关闭

FileInputStream fis;
fis = new FileInputStream(imagePath);
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inJustDecodeBounds = true;
//opt.outWidth; 
//opt.outHeight;
BitmapFactory.decodeFile(imagePath,opt);
Bitmap bitmap = BitmapFactory.decodeStream(fis,null, opt);

抱歉!评论已关闭.