Android的JPEG为位图的大小=减少 [英] Android JPEG to Bitmap = reduction in size

查看:136
本文介绍了Android的JPEG为位图的大小=减少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现后,我将我的JPEG文件为位图的大小几乎降低一半,这正常吗?我做这样的事情:

  = BMP1 BitmapFactory.de codeFILE(Environment.getExternalStorageDirectory()
                            +/测试/测试+ System.currentTimeMillis的()
                            +.JPG);
    ByteArrayOutputStream流=新ByteArrayOutputStream();
    bmp1.com preSS(Bitmap.Com pressFormat.JPEG,100,流);
    字节[]的字节数组= stream.toByteArray();
    的System.out.println(byteArray.length);


解决方案

您code为解码JPEG成位图,然后重新COM $ P $再次pssing它成JPEG。重新玉米pression很可能被降低文件的大小,在也降低了图象的质量的费用。

Jpeg的COM pression(甚至在品质100)不是无损的。

I noticed that after I converted my jpeg file into a bitmap the size drops almost by half, is this normal? I doing something like this:

    bmp1 = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory()
                            + "/Test/test" + System.currentTimeMillis()
                            + ".jpg");
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bmp1.compress(Bitmap.CompressFormat.JPEG, 100, stream);
    byte[] byteArray = stream.toByteArray();
    System.out.println(byteArray.length);

解决方案

Your code is decoding a jpeg into a bitmap and then re-compressing it into a jpeg again. The re-compression is likely to be reducing the file size, at the cost of also reducing the quality of the image.

Jpeg compression (even at quality 100) is not lossless.

这篇关于Android的JPEG为位图的大小=减少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆