0

I try to compress a 2M png image using Bitmap.compress(...) method。

Bitmap bitmap = decodeFroeSomeFile();  //It's a 2M png image.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
File result = generateFileFromStream(baos);  //It's a file larger then 2M

Because of I use a compression quality of 100, I think the file of the result file should equal to the origin file. But the result file is larger than the origin file. I can not figure it out according the API documents.

QuinnChen
  • 670
  • 1
  • 8
  • 29

1 Answers1

0

try this i am not sure about.but i actually use this

bitmap.compress(Bitmap.CompressFormat.JPEG, 80, baos);