Skip to content

Commit451/coil-transformations

Repository files navigation

coil-transformations

Image transformations for Coil.

Download

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Then, add the library to your app build.gradle

implementation("com.github.Commit451.coil-transformations:transformations:latest.version.here")

and for GPU (native) transformations (relies on GPUImage):

implementation("com.github.Commit451.coil-transformations:transformations-gpu:latest.version.here")

and for Google MLKit Face detection transformations:

implementation("com.github.Commit451.coil-transformations:transformations-face-detection:latest.version.here")

Supported Transformations

These transformations are already supported in Coil itself (no need for this library):

  • CircleCropTransformation
  • RoundedCornersTransformation

From the base library (transformations):

  • BlurTransformation
  • ColorFilterTransformation
  • CropTransformation (top, center, bottom)
  • GrayscaleTransformation
  • MaskTransformation
  • SquareCropTransformation

From the GPU library (transformations-gpu)

  • BrightnessFilterTransformation
  • ContrastFilterTransformation
  • InvertFilterTransformation
  • KuwaharaFilterTransformation
  • PixelationFilterTransformation
  • SepiaFilterTransformation
  • SketchFilterTransformation
  • SwirlFilterTransformation
  • ToonFilterTransformation
  • VignetteFilterTransformation

From the face detection library (transformations-center-on-face)

  • CenterOnFaceTransformation

Quick Start

To load an image into an ImageView with transformations, use the load extension function:

imageView.load("https://www.example.com/image.jpg") {
    transformations(BlurTransformation(), CircleCropTransformation()) // You can add as many as desired
}

Preview

See a preview of the transformations here

Thanks

Inspired by Glide Transformations by wasabeef. Thanks of course to Coil contributors for making a great image loading library.

License

Copyright 2024 Commit 451

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.