android - 查询CAMERA文件夹图像的宽度和高度
是否可以从 CAMERA 文件夹中查询具有高度和宽度的图像?
我现在只用 URL 来查询它。我想避免将图像加载到位图中,并且我需要事先知道它的宽度和高度,以便我可以计算出正确的缩放比例。现在,我加载的一些照片尺寸可能很大,有些可能很小。如果我对它们设置相同的缩放比例,它们看起来就不正确。小图像会无缘无故地调整大小。知道宽度和高度就可以解决这个问题。另外,我无法采样加载位图,因为当图像非常大时(例如使用 3 兆像素相机拍摄的图像),这会导致内存问题。
以下是我加载它们的方法:
https://stackoverflow.com/questions /5710036/android-camera-folder-images-not-all-show-up
谢谢。
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. 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在不获取整个数据的情况下对图像进行解码。
它不存在于数据库中的原因是用户始终可以修改图像以使其具有与原始图像不同的尺寸。
为了获取位图的最少信息,请使用以下内容:
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: