An Android transformation library providing a variety of image transformations for Glide.

Overview

Glide Transformations

Android Arsenal License Maven Central

An Android transformation library providing a variety of image transformations for Glide.

Please feel free to use this.

Are you using Picasso or Fresco?

Picasso Transformations
Fresco Processors

Demo

Original Image

Transformations

How do I use it?

Step 1

Gradle

repositories {
  mavenCentral()
}

dependencies {
  implementation 'jp.wasabeef:glide-transformations:4.3.0'
  // If you want to use the GPU Filters
  implementation 'jp.co.cyberagent.android:gpuimage:2.1.0'
}

Step 2

Set Glide Transform.

Glide.with(this).load(R.drawable.demo)
  .apply(RequestOptions.bitmapTransform(BlurTransformation(25, 3)))
  .into(imageView)

Advanced Step 3

You can set a multiple transformations.

val multi = MultiTransformation<Bitmap>(
  BlurTransformation(25),
  RoundedCornersTransformation(128, 0, CornerType.BOTTOM))))
Glide.with(this).load(R.drawable.demo)
  .apply(RequestOptions.bitmapTransform(multi))
  .into(imageView))

Transformations

Crop

  • CropTransformation
  • CropCircleTransformation
  • CropCircleWithBorderTransformation
  • CropSquareTransformation
  • RoundedCornersTransformation

Color

  • ColorFilterTransformation
  • GrayscaleTransformation

Blur

  • BlurTransformation

Mask

  • MaskTransformation

GPU Filter (use GPUImage)

Will require add dependencies for GPUImage.

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

Applications using Glide Transformations

Please ping me or send a pull request if you would like to be added here.

Icon Application
Ameba Ownd
AbemaTV
TV Time

Developed By

Daichi Furiya (Wasabeef) - [email protected]

Follow me on Twitter

Contributions

Any contributions are welcome!

Contributors

Thanks

License

Copyright (C) 2020 Wasabeef

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

   http://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.
Comments
  • Duplicate files during packaging of APK

    Duplicate files during packaging of APK

    With latest 1.3.0;

    Error:duplicate files during packaging of APK /Users/admin/Documents/Android/chillmo/app/build/outputs/apk/app-debugLive-unaligned.apk
        Path in archive: lib/armeabi-v7a/libblasV8.so
        Origin 1: /Users/admin/Documents/Android/chillmo/app/build/intermediates/exploded-aar/jp.wasabeef/glide-transformations/1.3.0/jni/armeabi-v7a/libblasV8.so
        Origin 2: /usr/local/Cellar/android-sdk/24.3.3/build-tools/23.0.2/renderscript/lib/packaged/armeabi-v7a/libblasV8.so
    You can ignore those files in your build.gradle:
        android {
          packagingOptions {
            exclude 'lib/armeabi-v7a/libblasV8.so'
          }
        }
    Error:Execution failed for task ':app:packageDebugLive'.
    > Duplicate files copied in APK lib/armeabi-v7a/libblasV8.so
        File 1: /Users/admin/Documents/Android/chillmo/app/build/intermediates/exploded-aar/jp.wasabeef/glide-transformations/1.3.0/jni/armeabi-v7a/libblasV8.so
        File 2: /usr/local/Cellar/android-sdk/24.3.3/build-tools/23.0.2/renderscript/lib/packaged/armeabi-v7a/libblasV8.so
    
    opened by iainconnor 14
  • in glide 4.0, RoundedCornersTransformation need implement  method updateDiskCacheKey

    in glide 4.0, RoundedCornersTransformation need implement method updateDiskCacheKey

    in glide 4.0, RoundedCornersTransformation need implement method updateDiskCacheKey. Exception like this: java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.load.Key.updateDiskCacheKey(java.security.MessageDigest)"

    opened by SureCoder 13
  • java.lang.RuntimeException: Canvas: trying to use a recycled bitmap

    java.lang.RuntimeException: Canvas: trying to use a recycled bitmap

    I have a button to apply transformation to my imageVew. I only got that error when apply ColorFilterTransformation and GrayscaleTransformation for the first time. But for the next time (restarting from 0), there is no problem.

            switch (filterSwitchCount) {
                case 0 :
                    transformation = new ContrastFilterTransformation(this, pool, 2.0f);
                    break;
                case 1 :
                    transformation = new ColorFilterTransformation(pool,
                            getResources().getColor(R.color.alpha_indigo));
                    break;
                case 2 :
                    transformation = new ToonFilterTransformation(this, pool);
                    break;
                case 3 :
                    transformation = new GrayscaleTransformation(pool);
                    break;
            }
    
            if (++filterSwitchCount > 3) {
                filterSwitchCount = 0;
            }
    
            bitmap = Glide.with(this)
                               .load(imagePath)
                               .asBitmap()
                               .transform(transformation)
                               .into(100, 100)
                               .get();
            imageView.setImageBitmap(bitmap);
    
    opened by Arkar-Aung 13
  • CenterCrop and Blur Transformation

    CenterCrop and Blur Transformation

    The following code doesn't work, the image is not centercropped

    Glide.with(context)
        .load(url)
        .centerCrop()
        .bitmapTransform(new BlurTransformation(context))
        .into(image);
    

    and this doesn't apply the transformation

    Glide.with(context)
        .load(url)
        .bitmapTransform(new BlurTransformation(context))
        .centerCrop()
        .into(image);
    
    opened by sourabhv 8
  • BlurTransformation with jpg

    BlurTransformation with jpg

    Hi,

    Don't seem to be able to blur a jpg image.

    Everything works great with a png. With the same code just changing the url to a jpg nothing happens

    Working png example: http://i.stack.imgur.com/ILTQq.png Not working jpg example: http://www.personal.psu.edu/jul229/mini.jpg

    Problem on nexus 4 running lollipop.

    Versions: jp.wasabeef:glide-transformations:1.0.6@aar jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3@aar

    Thanks in advance.

    opened by Stuart-campbell 8
  • The sizes of the corner for the Image are different

    The sizes of the corner for the Image are different

    ImageView in xml are all like this

    public static void loadCornerImage(final Context context, String url, final ImageView imageView) {
        Glide.with(context).load(url).placeholder(R.mipmap.list_pic_loading).bitmapTransform(new RoundedCornersTransformation(context, 10, 0)
        ).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(imageView);
    }
    

    qq 20160625120218

    opened by AndSync 7
  • Strange Behavior when I'm using RoundedCornersTransformation in RecyclerView

    Strange Behavior when I'm using RoundedCornersTransformation in RecyclerView

    Hi there I've an issue with RoundedCornersTransformation transformation. As you can see in image below, when I applied rounded transformation to my image, image repeated in top corners:

    screenshot_2016-05-12-09-23-29

    My code

                glide.load(url)
                    .priority(Priority.IMMEDIATE)
                    .override(width, height)
                    .diskCacheStrategy(DiskCacheStrategy.RESULT)
                    .skipMemoryCache(true)
                    .priority(Priority.IMMEDIATE)
                    .bitmapTransform(new RoundedCornersTransformation(this.image.getContext(), AndroidUtilities.dpToPx(6, this.image.getContext()), 0, RoundedCornersTransformation.CornerType.TOP))
                    .into(this.image);
    
    opened by IRMobydick 7
  • Additional resource cleanup in RSBlur

    Additional resource cleanup in RSBlur

    When the blur is finished, the input, output, and blur are all destroyed, along with the renderscript instance.

    This resolves a strictmode 'resource acquired but never released' violation:

    E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    
    java.lang.Throwable: Explicit termination method 'destroy' not called
    at dalvik.system.CloseGuard.open(CloseGuard.java:180)
    at android.renderscript.Script.<init>(Script.java:374)
    at android.renderscript.ScriptIntrinsic.<init>(ScriptIntrinsic.java:29)
    at android.renderscript.ScriptIntrinsicBlur.<init>(ScriptIntrinsicBlur.java:30)
    at android.renderscript.ScriptIntrinsicBlur.create(ScriptIntrinsicBlur.java:49)
    at jp.wasabeef.glide.transformations.internal.RSBlur.blur(RSBlur.java:42)
    at jp.wasabeef.glide.transformations.BlurTransformation.transform(BlurTransformation.java:93)
    at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperTransformation.transform(GifBitmapWrapperTransformation.java:34)
    at com.bumptech.glide.load.engine.DecodeJob.transform(DecodeJob.java:236)
    at com.bumptech.glide.load.engine.DecodeJob.transformEncodeAndTranscode(DecodeJob.java:139)
    at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:129)
    at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)
    at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)
    at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)
    at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)
    
    opened by timusus 6
  • Glide 4.0 stable released

    Glide 4.0 stable released

    https://github.com/bumptech/glide/releases/tag/v4.0.0 I think that this library should be updated to avoid copying out and modify each class manually.

    opened by b95505017 5
  • Error on using Blur transformation on some devices [java.lang.UnsatisfiedLinkError]

    Error on using Blur transformation on some devices [java.lang.UnsatisfiedLinkError]

    I get this exception on Samsung Galaxy Note 2 only.

    onException(android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "librsjni.so", http://myapp.com/image_url.jpg, Target for: android.support.v7.widget.AppCompatImageView{66ff4da V.ED.... ........ 0,0-1440,896 #7f1102d9 app:id/backdrop}, true) android.support.v8.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.reado.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "librsjni.so" at android.support.v8.renderscript.RenderScript.internalCreate(RenderScript.java:1347) at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1504) at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1454) at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1430) at android.support.v8.renderscript.RenderScript.create(RenderScript.java:1417) at jp.wasabeef.glide.transformations.BlurTransformation.transform(BlurTransformation.java:95) at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperTransformation.transform(GifBitmapWrapperTransformation.java:34) at com.bumptech.glide.load.engine.DecodeJob.transform(DecodeJob.java:236) at com.bumptech.glide.load.engine.DecodeJob.transformEncodeAndTranscode(DecodeJob.java:139) at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:129) at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122) at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101) at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118)

    This looks related - https://code.google.com/p/android/issues/detail?id=182356

    Is this a known issue? Do we have a workaround for this?

    opened by vinaywadhwa 5
  • Compilation error with proguard

    Compilation error with proguard

    When using version 4.0.0/4.0.1 and proguard enabled I receive this messages:

    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript$RSMessageHandler |  
    -- | --
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation$MipmapControl |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RSRuntimeException |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript$RSMessageHandler |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation$MipmapControl |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Element |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.ScriptIntrinsicBlur |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.ScriptIntrinsicBlur |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.RenderScript |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.Allocation |  
    jp.wasabeef.glide.transformations.internal.SupportRSBlur: can't find referenced class androidx.renderscript.ScriptIntrinsicBlur |  
    

    Please let me know if you need some more information.

    Thanks

    opened by owolp 4
  • Fix CropTransformation for use case with width = 0 and height = 0

    Fix CropTransformation for use case with width = 0 and height = 0

    As Glide documentation says, Transformations are meant to be statless. The transform method instead changes the properties width and height in the very first lines: each property is immutable only if its initial value is not zero. Moreover the bitmap toTransform is the original bitmap, so you should not use its size as the desired size of the resulting bitmap; you have to use the parameters outWidth and outHeight, instead.

    opened by dscoppelletti 0
  • Failed to resolve: jp.wasabeef:glide-transformations:4.1.0 in Android studio

    Failed to resolve: jp.wasabeef:glide-transformations:4.1.0 in Android studio

    Future Task

    What is the motivation?

    What kind of solution can be considered?

    What do you want to discuss?

    Please add relevant labels


    Bug Reporting

    Steps to Reproduce

    Actual Results (include screenshots)

    Expected Results (include screenshots)

    URL

    OS details

    • Device:
    • OS:

    Please add relevant labels

    opened by MinhazRahman 0
  • Glide version 4.11 causing crash on Huawei devices.

    Glide version 4.11 causing crash on Huawei devices.

    Bug Reporting

    Glide version 4.11 causing crashes on Huawei devices.

    References:

    • https://github.com/bumptech/glide/issues/4116
    • https://github.com/bumptech/glide/issues/4165

    Downgrading the glide version to 4.10 should solve the issue.

    opened by yeamin27 1
  • signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) crash spike after updating to 4.3.0

    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) crash spike after updating to 4.3.0

    After updating to 4.3.0 I saw a significant spike in crashes in the native library. I use BlurTransformation in my code and looks like the new version uses RenderScript to accomplish that which I suspect is causing an issue. Here is crashlog that I get.

    backtrace:
      #00  pc 0000000000018bf8  /system/vendor/lib64/libRSDriver_adreno.so (rsdScriptSetGlobalVar(android::renderscript::Context const*, android::renderscript::Script const*, unsigned int, void*, unsigned long)+28)
      #00  pc 000000000003c6dc  /system/lib64/libRS_internal.so (android::renderscript::rsi_ScriptSetVarF(android::renderscript::Context*, void*, unsigned int, float)+68)
      #00  pc 0000000000042f50  /system/lib64/libRS_internal.so (android::renderscript::ThreadIO::playCoreCommands(android::renderscript::Context*, int)+680)
      #00  pc 00000000000272fc  /system/lib64/libRS_internal.so (android::renderscript::Context::threadProc(void*)+2152)
      #00  pc 0000000000099508  /system/lib64/libc.so (__pthread_start(void*)+36)
      #00  pc 0000000000023e18  /system/lib64/libc.so (__start_thread+68)
    
    opened by antonb03 4
Owner
Daichi Furiya
Google Developers Expert for Android
Daichi Furiya
🍂 Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

?? Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

Jaewoong Eum 1.4k Jan 2, 2023
Glide Bitmap Pool is a memory management library for reusing the bitmap memory

Glide Bitmap Pool About Glide Bitmap Pool Glide Bitmap Pool is a memory management library for reusing the bitmap memory. As it reuses bitmap memory ,

AMIT SHEKHAR 573 Dec 31, 2022
Load images using Glide

Glide_Demo Load images using Glide Image used private val image = "https://cdn.pixabay.com/photo/2018/05/03/21/49/android-3372580_1280.png" Add Glide

Daniel Kago K 0 Nov 1, 2021
An image loading and caching library for Android focused on smooth scrolling

Glide | View Glide's documentation | 简体中文文档 | Report an issue with Glide Glide is a fast and efficient open source media management and image loading

Bump Technologies 33.2k Jan 7, 2023
A powerful image downloading and caching library for Android

Picasso A powerful image downloading and caching library for Android For more information please see the website Download Download the latest AAR from

Square 18.4k Jan 6, 2023
An android image compression library.

Compressor Compressor is a lightweight and powerful android image compression library. Compressor will allow you to compress large photos into smaller

Zetra 6.7k Jan 9, 2023
Library to handle asynchronous image loading on Android.

WebImageLoader WebImageLoader is a library designed to take to hassle out of handling images on the web. It has the following features: Images are dow

Alexander Blom 102 Dec 22, 2022
Compose Image library for Kotlin Multiplatform.

Compose ImageLoader Compose Image library for Kotlin Multiplatform. Setup Add the dependency in your common module's commonMain sourceSet kotlin {

Seiko 45 Dec 29, 2022
Android Asynchronous Networking and Image Loading

Android Asynchronous Networking and Image Loading Download Maven Git Features Kotlin coroutine/suspend support Asynchronously download: Images into Im

Koushik Dutta 6.3k Dec 27, 2022
Image loading for Android backed by Kotlin Coroutines.

An image loading library for Android backed by Kotlin Coroutines. Coil is: Fast: Coil performs a number of optimizations including memory and disk cac

Coil 8.8k Jan 8, 2023
Image Picker for Android 🤖

Image Picker for Android ??

Esa Firman 1k Dec 31, 2022
Luban(鲁班)—Image compression with efficiency very close to WeChat Moments/可能是最接近微信朋友圈的图片压缩算法

Luban ?? English Documentation Luban(鲁班) —— Android图片压缩工具,仿微信朋友圈压缩策略。 Luban-turbo —— 鲁班项目的turbo版本,查看trubo分支。 写在前面 家境贫寒,工作繁忙。只能不定期更新,还望网友们见谅! 项目描述 目前做A

郑梓斌 13.1k Jan 7, 2023
ZoomableComposeImage - A zoomable image for jetpack compose

ZoomableComposeImage - A zoomable image for jetpack compose

RERERE 10 Dec 11, 2022
ComposeImageBlurhash is a Jetpack Compose component with the necessary implementation to display a blurred image

compose-image-blurhash ComposeImageBlurhash is a Jetpack Compose component with the necessary implementation to display a blurred image while the real

Orlando Novas Rodriguez 24 Nov 18, 2022
Easy to use, lightweight custom image view with rounded corners.

RoundedImageView Easy to use, lightweight custom image view with rounded corners. Explore the docs » View Demo · Report Bug · Request Feature About Th

Melik Mehmet Özyildirim 6 Dec 23, 2021
load-the-image Apply to compose-jb(desktop), Used to load network and local pictures.

load-the-image load-the-image Apply to compose-jb(desktop), Used to load network and local pictures. ?? Under construction It may change incompatibly

lt_taozi 13 Dec 29, 2022
Powerful and flexible library for loading, caching and displaying images on Android.

Universal Image Loader The great ancestor of modern image-loading libraries :) UIL aims to provide a powerful, flexible and highly customizable instru

Sergey Tarasevich 16.8k Jan 8, 2023
An Android library for managing images and the memory they use.

Fresco Fresco is a powerful system for displaying images in Android applications. Fresco takes care of image loading and display, so you don't have to

Facebook 16.9k Jan 8, 2023
Photo picker library for android. Let's you pick photos directly from files, or navigate to camera or gallery.

ChiliPhotoPicker Made with ❤️ by Chili Labs. Library made without DataBinding, RxJava and image loading libraries, to give you opportunity to use it w

Chili Labs 394 Jan 2, 2023