Probably the fastest image compression framework on the Android platform.

Rely on

dependencies { ... The compile 'com. Android. Support: appcompat - v7:25.3.1' compile 'com. Ghnor: flora: 1.0.0-1'}Copy the code

Controlled compression tasks

Flora.with(Activity)
Flora.with(FragmentActivity)
Flora.with(Fragment)
Flora.with(SupportFragment)
//The above four categories automatically terminate the compression task at the end of the page life cycle.

//End a series of tasks with a TAG bit.
Flora.with(TAG)
//Forcibly end a task.
Flora.cancel(TAG);

//If this parameter is not used, the task is not controlled. It is strongly recommended not to use this method.
Flora.with() Copy the code

other

  • Compression speed

Internal use of thread pool scheme to compress tasks, while the necessary memory check.

Under the premise of not OOM, the maximum speed of compression is improved. The common size of 9 pictures is 20M+ and can be processed in 2S.

Of course, the machine performance, the system at the time of memory are affected by this, my test machine is [magic blue Note]…

  • Effect of compression

Since the compression strategy is integrated with Luban, the final comparison of image compression size before and after can refer to Luban.

Based on this, I optimized the requirements of long graphs common in social products.