image.compress() This method will not reduce the size of the Bitmap at all, and it cannot achieve image compression. So your baos and isBm both occupy less memory space. It’s better to use inSampleSize directly for compression
According to the way you write it, the insamplesize of a 2000*1400 photo will be set to 1, and the memory required for decoding will soar very high. If there are no special requirements for clarity, there is no need to set the image width and height to For mainstream screen sizes, targetsize can be set to half of the high value to display clearly In addition, available memory can be dynamically monitored in real time to dynamically adjust insamplesize
Since both of your methods receive a Bitmap的参数,那么在调用时,你肯定已经将图片读取到内存中了。造成内存飙升是肯定的。 如果要进行图片压缩,那么最好接受图片的存储位置,在读取的时候进行压缩,这里可以通过Optionsthis class to set and then save. Regarding image compression, try not to load the original image into the memory. If an instance of the original image has been created, the memory will easily explode.
image.compress() This method will not reduce the size of the Bitmap at all, and it cannot achieve image compression. So your baos and isBm both occupy less memory space. It’s better to use inSampleSize directly for compression
According to the way you write it, the insamplesize of a 2000*1400 photo will be set to 1, and the memory required for decoding will soar very high.
If there are no special requirements for clarity, there is no need to set the image width and height to For mainstream screen sizes, targetsize can be set to half of the high value to display clearly
In addition, available memory can be dynamically monitored in real time to dynamically adjust insamplesize
Since both of your methods receive a
Bitmap
的参数,那么在调用时,你肯定已经将图片读取到内存中了。造成内存飙升是肯定的。如果要进行图片压缩,那么最好接受图片的存储位置,在读取的时候进行压缩,这里可以通过
Options
this class to set and then save.Regarding image compression, try not to load the original image into the memory. If an instance of the original image has been created, the memory will easily explode.