开发者

android - query CAMERA folder images with width and height

is it possible to query for images from CAMERA folder with height and width?

I am querying it with only URL right now. I want to avoid loading image into Bitmap and I need to have width and height of it beforehand so I can figure out proper scaling. Right now some of the photos I load can be really large size and some can be tiny. If I set same scaling on them they don't look right. 开发者_Python百科Small images get resized for no reason. Knowing width and height would solve this. Also I cannot sample load a bitmap because that causes memory issue when images are really large, like those taken with 3 megapixel camera.

Here is how I load them:

https://stackoverflow.com/questions/5710036/android-camera-folder-images-not-all-show-up

Thank you.


You should do decoding for the image without getting its whole data.

the reason it doesn't exist on the DB is that the user can always modify the images to have different dimensions than the original one.

in order to get just the minimal information of the bitmap, use something like:

public static BitmapFactory.Options getBitmapOptions(final String filePath) {
    final BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
    bitmapOptions.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(filePath, bitmapOptions);
    return bitmapOptions;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜