获取bitmap字节数

来源:互联网 发布:dame it 编辑:程序博客网 时间:2024/06/03 22:58

针对图片 压缩 需要  查看  到底 压缩了多少 byte,


public static int getBitmapBytes(Bitmap bitmap) {    int result;    if(VERSION.SDK_INT >= 12) {        result = bitmap.getByteCount();    } else {        result = bitmap.getRowBytes() * bitmap.getHeight();    }    if(result < 0) {        throw new IllegalStateException("Negative size: " + bitmap);    } else {        return result;    }}

原创粉丝点击