Example of Android compressing a picture to a specified size

A method of self writing after collecting from the Internet;

1. The first is a class of compression according to resolution. First, the picture is compressed once

2. The second is to cycle the compression of the picture until it is compressed below the specified size (important!)

In which

This method is used to dynamically set the proportion of each compression. It is mainly used to improve the compression time. The value is probably tested by me and can be modified to what you think is more appropriate

3. Finally

Compressing pictures takes time and memory. Obviously, the execution needs to be completed in the sub thread. If necessary, a compressed listener can be added

Download address: commonutils_ jb51.rar

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>