【问题标题】:Is the image size and bitmap size equivalent in android?android中的图像大小和位图大小是否相等?
【发布时间】:2013-12-04 09:35:33
【问题描述】:

我有点困惑,因为我正在计算图像的大小。

我在 android 中使用以下代码:-

String fileUrl = getIntent().getExtras().getString("fileurl");
BitmapFactory.Options option = new BitmapFactory.Options();
option.inPurgeable = true;

Bitmap bitmap= BitmapFactory.decodeFile(fileUrl,option);
        Log.e("Fill Image Size in Bytes","====>"+bitmap.getByteCount());

上面的函数bitmap.getByteCount()返回的值与图片的原始大小不同(与ubuntu中右键点击图片大小比较)。

如果有人有想法,请回复。

提前谢谢...

【问题讨论】:

  • 图片的实际大小(以字节为单位)和从 getByteCount() 返回的值是多少?

标签: android bitmap size byte


【解决方案1】:

您可以在没有选项的情况下解码位图,看看有什么区别。

Bitmap bitmap= BitmapFactory.decodeFile(fileUrl);
Log.e("Fill Image Size in Bytes","====>"+bitmap.getByteCount());

options的默认值可以缩小尺寸。

【讨论】:

    【解决方案2】:

    可能由 Bitmap.config 和位图大小决定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-29
      • 2011-10-09
      • 2015-06-04
      • 2015-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-11
      相关资源
      最近更新 更多