如何从Base64高效解码JPEG?

时间:2012-11-27 22:34:33

标签: android base64 jpeg

在我的Android应用程序中,我从相机捕获图像,将其压缩为jpeg,将其发送到服务器并将其保存在硬盘驱动器上。它需要48,9kb(例如)。我将它发送回Base64-String并在Android端解码,如下所示:

byte[] img;
img = Base64.decode(base64, Base64.DEFAULT);
ByteArrayInputStream in = new ByteArrayInputStream(img);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 3;

Bitmap bmp = BitmapFactory.decodeStream(in, null, options);
return bmp;

的值大于3
options.inSampleSize

会使图像看起来很难看。但如果我现在看看

的大小
bmp
它是156kb。为什么尺寸会增加?我如何解码它,以便它保持原始大小并且看起来不丑(太难下采样)?

0 个答案:

没有答案