小编pbu*_*pbu的帖子

"Bitmap.createScaledBitmap"将32位图像转换为24位吗?

在我的应用程序中,我以这种方式将图像加载为32位(ARGB_8888):

 Bitmap.Config mBitmapConfig;
 mBitmapConfig = Bitmap.Config.ARGB_8888; 
 BitmapFactory.Options options = new BitmapFactory.Options();
 options.inPreferredConfig = mBitmapConfig;
 mBitmap = BitmapFactory.decodeFile(SourceFileName, options);
Run Code Online (Sandbox Code Playgroud)

然后缩放:

mBitmap = Bitmap.createScaledBitmap(mBitmap, iW, iH, true); 
Run Code Online (Sandbox Code Playgroud)

如果我用于缩放原始位图的相同宽度和高度,则它是以兆字节为单位的1/2的大小(我正在观察堆大小).将值"ARGB_8888"更改为"RGB_565"(24位)可在缩放后提供相同的大小(兆字节).

有人可以解释这个现象,可能会给我一个建议,如何在32位色彩空间中缩放位图?谢谢!

android bitmap

7
推荐指数
1
解决办法
7184
查看次数

如何在没有ExifInterface的情况下确定图片的方向?

我将图像加载到a中bitmap并且需要知道所拍摄图像的方向(来自相机)以正确显示它.使用以下代码的方法工作得很好(自API级别5以来),但该怎么办android:minSdkVersion="4"?还有另外一种方法吗?

ExifInterface exif = new ExifInterface(SourceFileName);     //Since API Level 5
String exifOrientation = exif.getAttribute(ExifInterface.TAG_ORIENTATION);
Run Code Online (Sandbox Code Playgroud)

android exif orientation

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×2

bitmap ×1

exif ×1

orientation ×1