zetbaitsu / Compressor

An android image compression library.
7.08k stars 963 forks source link

Create friendly api to Compressor #148

Closed jeziellago closed 3 years ago

jeziellago commented 4 years ago

Create friendly "API" to compressor:

ImageCompressor.with(context)  
 .launchOn(Dispatchers.IO) // set a CoroutineContext (Optional, default = Dispatchers.IO)
 .observeOn(lifecycleScope) // set a CoroutineScope
 .applyCompressionWith { // options 
    resolution(1280, 720) 
    format(Bitmap.CompressFormat.WEBP) 
    ... 
 }.compress(inputImg) { outputImage -> 
    // get output image here 
 }

With that implementation is possible to use any DI framework to provide an ImageCompressor instance, enabling more reusability and decoupling of android Context.

See implementation here ImageCompressor.kt

codecov[bot] commented 4 years ago

Codecov Report

Merging #148 into master will increase coverage by 0.11%. The diff coverage is 80.76%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #148      +/-   ##
============================================
+ Coverage     80.18%   80.30%   +0.11%     
- Complexity       31       38       +7     
============================================
  Files             9       10       +1     
  Lines           106      132      +26     
  Branches         12       15       +3     
============================================
+ Hits             85      106      +21     
- Misses           17       20       +3     
- Partials          4        6       +2     
Impacted Files Coverage Δ Complexity Δ
.../main/java/id/zelory/compressor/ImageCompressor.kt 80.76% <80.76%> (ø) 7.00 <7.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d062a66...e13c80a. Read the comment docs.

jeziellago commented 4 years ago

Hi @zetbaitsu I'm happy to propose a contribution to Compressor. Could you review those changes? Thanks!!! 😁

mochadwi commented 2 years ago

any concern closing this? @jeziellago

jeziellago commented 2 years ago

any concern closing this? @jeziellago

Lack of feedback from owner of this repository. I created my own. https://github.com/jeziellago/image-minifier