Skip to content

Minifier is a lightweight android library for image resizing, format changing and quality focusing in reduce file size 🖼.

License

Notifications You must be signed in to change notification settings

jeziellago/image-minifier

Repository files navigation

Image Minifier

CI

Minifier is a lightweight (21KB) android library for image resizing, format changing and quality focusing in reduce file size.

How it works?

With an image file, apply one or multiples transformations:

MinifierFactory.create(context)
    .withImage(originalFile)
    .addTransformations {
        resize(1200, 720)
        convertTo(CompressFormat.JPEG)
    }
    .minify {
        onSuccess { minified -> /* success */ }
        onFailure { error -> /* failure */ }
    }
        

or use coroutines:

val minifiedFile: File = MinifierFactory.create(context)
    .withImage(originalFile)
    .addTransformations {
        resize(1200, 720)
        convertTo(CompressFormat.JPEG)
    }
    .minifyWith(Dispatchers.Default)
    .onSuccess { minified -> /* success */ }
    .onFailure { error -> /* failure */ }

Transformations

  • Resize
resize(1200, 720)
  • Format
convertTo(CompressFormat.JPEG)
  • Gray scale
colorGrayScale()
  • Quality
quality(80)

Dependencies

  • Project build.gradle
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Module build.gradle
dependencies {
    implementation 'com.github.jeziellago:image-minifier:0.2.0'
}

About

Minifier is a lightweight android library for image resizing, format changing and quality focusing in reduce file size 🖼.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages