bitmap.createScaledBitmap() 没有调整从 url 检索到的图像大小?
我正在尝试使用它调整位图大小...
try {
bitmap = BitmapFactory.decodeStream((InputStream)new URL(url).getContent());
Bitmap.createScaledBitmap(bitmap, 1000, 100, true);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
但它不起作用。图像保持相同的大小。
这是调整位图大小的正确方法吗?
或者还有别的办法吗?
I am trying to resize a bitmap using this...
try {
bitmap = BitmapFactory.decodeStream((InputStream)new URL(url).getContent());
Bitmap.createScaledBitmap(bitmap, 1000, 100, true);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Its not working though. The images stay the same size.
Is this the right way to resize the bitmap?
Or is there another way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过 bitmap=createScaledBitmap(..) 并检查?该方法返回一个新的位图。
http://developer.android.com/reference/android/graphics/Bitmap.html#createScaledBitmap%28android.graphics.Bitmap,%20int,%20int,%20boolean%29
Did you try bitmap=createScaledBitmap(..) and check? That method returns a new bitmap.
http://developer.android.com/reference/android/graphics/Bitmap.html#createScaledBitmap%28android.graphics.Bitmap,%20int,%20int,%20boolean%29