Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wasabeef/transformers
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.
https://github.com/wasabeef/transformers
android coil fresco glide gpuimage image-processing picasso transformation
Last synced: about 12 hours ago
JSON representation
An Android transformation library providing a variety of image transformations for Coil, Glide, Picasso, and Fresco.
- Host: GitHub
- URL: https://github.com/wasabeef/transformers
- Owner: wasabeef
- License: apache-2.0
- Created: 2019-10-25T15:53:40.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T10:50:21.000Z (almost 3 years ago)
- Last Synced: 2025-01-13T15:12:41.150Z (8 days ago)
- Topics: android, coil, fresco, glide, gpuimage, image-processing, picasso, transformation
- Language: Kotlin
- Homepage: https://github.com/wasabeef/transformers
- Size: 50 MB
- Stars: 304
- Watchers: 8
- Forks: 18
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
## What is Transformers?
An Android transformation library providing a variety of image transformations for [Coil], [Glide], [Picasso], and [Fresco].
### Part of the sample
> [Glide Transformations](https://github.com/wasabeef/glide-transformations), [Picasso Transformations](https://github.com/wasabeef/picasso-transformations), [Fresco Processors](https://github.com/wasabeef/fresco-processors) are deprecated.
> Development will stop soon.. For an up-to-date version, please use this.## Installation
### Requirements
- Android 5.0+ Lollipop (API level 21)### Gradle settings
```gradle
repositories {
mavenCentral()
}
```**This Transformer is NOT using [android.support.v8.rendererscript](https://developer.android.com/guide/topics/renderscript/compute#ide-setup) because `librs.so` make the APK file too big.**
#### For [Coil]
```gradle
dependencies {
implementation 'jp.wasabeef.transformers:coil:1.0.6'
// Use the GPU Filters
implementation 'jp.wasabeef.transformers:coil-gpu:1.0.6'
}
```
```kotlin
imageView.load(IMAGE_URL) {
transformations(
CropCenterTransformation(),
RoundedCornersTransformation(radius = 120, cornerType = CornerType.DIAGONAL_FROM_TOP_LEFT)
)
}
```#### For [Glide]
```gradle
dependencies {
implementation 'jp.wasabeef.transformers:glide:1.0.6'
// Use the GPU Filters
implementation 'jp.wasabeef.transformers:glide-gpu:1.0.6'
}
```
```kotlin
Glide.with(context)
.load(IMAGE_URL)
.apply(
bitmapTransform(
MultiTransformation(
CropCenterTransformation(),
BlurTransformation(context, 15, sampling = 1)
)
)
).into(imageView)
```#### For [Picasso]
```gradle
dependencies {
implementation 'jp.wasabeef.transformers:picasso:1.0.6'
// Use the GPU Filters
implementation 'jp.wasabeef.transformers:picasso-gpu:1.0.6'
}
```
```kotlin
Picasso.get()
.load(IMAGE_URL)
.fit().centerInside()
.transform(
mutableListOf(
CropCenterTransformation(),
BlurTransformation(context, 25, sampling = 4)
)
).into(imageView)
```#### For [Fresco]
```gradle
dependencies {
implementation 'jp.wasabeef.transformers:fresco:1.0.6'
// Use the GPU Filters
implementation 'jp.wasabeef.transformers:fresco-gpu:1.0.6'
}
```
```kotlin
val request: ImageRequest =
ImageRequestBuilder.newBuilderWithSource(IMAGE_URL.toUri())
.setPostprocessor(BlurPostprocessor(context, 25, 4))
.build()holder.image.controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(draweeView.controller)
.build()
```### With Jetpack Compose
Use [Composable Images](https://github.com/wasabeef/composable-images) when using with Jetpack Compose.
```kotlin
GlideImage(
model = IMAGE_URL,
modifier = Modifier.preferredWidth(120.dp),
options = RequestOptions().transform(
BlurTransformation(context, radius = 25, sampling = 4)
)
)
```### Sample transformations
| Original | Mask | NinePatchMask | CropTop |
|:---:|:---:|:---:|:---:|
| | | | |
| CropCenter | CropBottom | CropCenterRatio16x9 | CropCenterRatio4x3 |
| | | | |
| CropTopRatio16x9 | CropBottomRatio4x3 | CropSquare | CropCircle |
| | | | |
| CropCircleWithBorder | ColorFilter | Grayscale | RoundedCorners |
| | | | |
| RoundedCornersTopLeft | RSGaussianBlurLight | RSGaussianBlurDeep | StackBlurLight |
| | | | |
| StackBlurDeep |
| |coil, glide, picasso
- BlurTransformation
- ColorFilterTransformation
- CropCenterBottomTransformation
- CropCenterTopTransformation
- CropCenterTransformation
- CropCircleTransformation
- CropCircleWithBorderTransformation
- CropSquareTransformation
- CropTransformation
- GrayscaleTransformation
- MaskTransformation
- RoundedCornersTransformationfresco
- BlurPostprocessor
- ColorFilterPostprocessor
- CombinePostProcessors
- GrayscalePostprocessor
- MaskPostprocessor### Sample transformations with [GPUImage](https://github.com/cats-oss/android-gpuimage)
We recommend that you have a ToneCurve file, as you can apply any filters you like.
| Original | Sepia | Contrast | Invert |
|:---:|:---:|:---:|:---:|
| | | | |
| PixelLight | PixelDeep | Sketch | Swirl |
| | | | |
| Brightness | Kuawahara | Vignette | ZoomBlur |
| | | | |
| WhiteBalance | Halftone | Sharpness | Toon |
| | | | |
| ToneCurve |
| |coil-gpu, glide-gpu, picasso-gpu
- BrightnessFilterTransformation
- ContrastFilterTransformation
- HalftoneFilterTransformation
- InvertFilterTransformation
- KuwaharaFilterTransformation
- PixelationFilterTransformation
- SepiaFilterTransformation
- SharpenFilterTransformation
- SketchFilterTransformation
- SwirlFilterTransformation
- ToneCurveFilterTransformation
- ToonFilterTransformation
- VignetteFilterTransformation
- WhiteBalanceFilterTransformation
- ZoomBlurFilterTransformationfresco-gpu
- BrightnessFilterPostprocessor
- ContrastFilterPostprocessor
- HalftoneFilterPostprocessor
- InvertFilterPostprocessor
- KuwaharaFilterPostprocessor
- PixelationFilterPostprocessor
- SepiaFilterPostprocessor
- SharpenFilterPostprocessor
- SketchFilterPostprocessor
- SwirlFilterPostprocessor
- ToneCurveFilterPostprocessor
- ToonFilterPostprocessor
- VignetteFilterPostprocessor
- WhiteBalanceFilterPostprocessor
- ZoomBlurFilterPostprocessor## Development
### Setup
Things you will need
- Linux, Mac OS X, or Windows.
- [Android Studio (Preview)](https://developer.android.com/studio/preview)
- npm```
$ npm install
```### Build
```
$ ./gradlew assemble
```### Formatting
```
$ ./gradlew ktlint
```### Publishing to [Maven Central](https://search.maven.org/)
```
$ ./gradlew :core:clean :core:build :core:publish
....
....
```[Coil]: https://github.com/coil-kt/coil
[Glide]: https://github.com/bumptech/glide
[Picasso]: https://github.com/square/picasso
[Fresco]: https://github.com/facebook/fresco