Problems with different file sizes when loading and rewriting files to Bitmap

Asked 1 years ago, Updated 1 years ago, 79 views

Bring the pictures of the gallery from Android and put them on Bitmap

bm.compress(Bitmap.CompressFormat.PNG, SAMPLING, out); 
bm.compress(Bitmap.CompressFormat.JPEG, SAMPLING, out);

What's wrong with the size of the original file and the new file written out when writing a new file using the?

android bitmap

2022-09-22 21:11

1 Answers

The file size changes because the Bitmap.compression() function compresses the bitmap object (image information loaded in memory) to a file in PNG, JPEG format. Since the function does not store the image as a compression option in the same state as the original file, the file size may rather vary.I think that would be appropriate.

For example, when you open a PNG file with an image editor such as Photoshop and save it as a new PNG file, you can see that the file size varies depending on the option to compress it. You can see it as a similar phenomenon.


2022-09-22 21:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.