读取SD卡图片 转化Bitmap
来源:互联网 发布:光环大数据和达内 编辑:程序博客网 时间:2024/06/05 17:00
原地址http://my.oschina.net/guandongchen/blog/100283
public static Bitmap convertToBitmap(String path, int w, int h) { BitmapFactory.Options opts = new BitmapFactory.Options(); // 设置为ture只获取图片大小 opts.inJustDecodeBounds = true; opts.inPreferredConfig = Bitmap.Config.ARGB_8888; // 返回为空 BitmapFactory.decodeFile(path, opts); int width = opts.outWidth; int height = opts.outHeight; float scaleWidth = 0.f, scaleHeight = 0.f; if (width > w || height > h) { // 缩放 scaleWidth = ((float) width) / w; scaleHeight = ((float) height) / h; } opts.inJustDecodeBounds = false; float scale = Math.max(scaleWidth, scaleHeight); opts.inSampleSize = (int)scale; WeakReference<Bitmap> weak = new WeakReference<Bitmap>(BitmapFactory.decodeFile(path, opts)); return Bitmap.createScaledBitmap(weak.get(), w, h, true); }
0 0
- 读取SD卡图片 转化Bitmap
- 读取SD卡图片 转化Bitmap
- 读取本地(SD卡)图片转为Bitmap
- 解决 读取sd卡图片,判断Bitmap 为null
- 读取图片资源转化为bitmap对象
- bitmap写入sd卡,从sd卡读取bitmap
- 读取sd卡下图片,由图片路径转换为bitmap
- 读取sd卡下图片,由图片路径转换为bitmap
- 读取sd卡下图片,由图片路径转换为bitmap
- 读取sd卡下图片,由图片路径转换为bitmap
- android保存Bitmap图片到sd卡
- Android 读取本地(SD卡)图片
- 读取sd卡上的图片
- 读取SD卡下的图片
- Android 读取本地(SD卡)图片
- 安卓读取SD卡图片
- android 读取sd卡中的图片
- android 读取sd卡中的图片
- 浮躁程序员的建议
- 【校内互测】拯救
- 解决带清单文件(manifest)C程序移植到XP时无法显示控件的问题
- 安全测试之没有限制URL访问
- POJ 1151 Atlantis 线段树面积并
- 读取SD卡图片 转化Bitmap
- 蓝懿ios技术交流和心得分享6.1.29
- Android 常见面试题总结
- 求算术表达式的值
- 封装
- Drawable转换为Bitmap两种方法
- Core Animation系列之CADisplayLink
- SMSDemo android 简单拦截短信例子可以实现发 远程控制
- js正则表达式简单例子