将一个图片的url地址转换为一个bitmap图片
2013-05-09 10:29
351 查看
转载▼
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
int max = conn.getContentLength();
InputStream is = conn.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
while ((len = is.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
byte[] result = baos.toByteArray();
return BitmapFactory.decodeByteArray(result, 0, result.length);
} catch (Exception e) {
e.printStackTrace();
return null;
}
相关文章推荐
- 转换一个JPG/GIF格式的图片到BITMAP位图格式.
- Android代码(Handler的运用),HttpURLConnection的应用,将url图片地址转换成图片。
- 获取地址栏的IP和端口,将URL地址图片转换为二进制
- 通过一个网络url地址获取一个bitmap对象
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- 一个URL或图片地址是否有效
- 一个解析URL及图片地址的JS函数
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byt
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- Android代码(Handler的运用),HttpURLConnection的应用,将url图片地址转换成图片。
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- 安卓从相机取出图片,并截图,然后对bitmap转换成base64的处理,和对base64转为bitmap的处理
- 怎么把多张图片转换成为一个PDF文件
- php-curl获取接口图片地址,在php拼接img中无法访问,报403错误,在浏览器url中直接可以访问,html页面里img也可以访问
- android 获取资源文件 R.drawable中的图片转换为drawable、bitmap(转载)
- 七牛iOS按顺序依次上传多张图片,一个block返回所有上传的url
- android将drawable下的图片转换成bitmap
- Java中判断URL地址的图片是否有效