【发布时间】:2011-06-08 10:17:16
【问题描述】:
我已将图像存储到数据库。我可以获得 blob,但无法找到其正确的高度和宽度,并且硬编码每个图像的宽度和高度并不是一个好主意。请帮帮我
【问题讨论】:
-
同一个问题不要问两次,人家会回答的。
标签: android image height width blob
我已将图像存储到数据库。我可以获得 blob,但无法找到其正确的高度和宽度,并且硬编码每个图像的宽度和高度并不是一个好主意。请帮帮我
【问题讨论】:
标签: android image height width blob
img 将是您在drawable 中的图像。
【讨论】:
得到答案
http://apachejava.blogspot.com/2011/01/get-width-and-height-of-image-blob.html
public Bitmap convertBlobToBitmap(byte[] blobByteArray) {
Bitmap tempBitmap=null;
if(blobByteArray!=null)
tempBitmap = BitmapFactory.decodeByteArray(blobByteArray, 0, blobByteArray.length);
return tempBitmap;
}
Bitmap temp_bitmapImg = convertBlobToBitmap(BitmapArrayOfImage());
int height = temp_bitmapImg .getHeight();
int width = temp_bitmapImg .getWidth();
【讨论】: