GithubHelp home page GithubHelp logo

wasabeef / glide-transformations Goto Github PK

View Code? Open in Web Editor NEW
9.9K 202.0 1.4K 25.89 MB

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

License: Apache License 2.0

Java 89.36% Kotlin 10.64%
android android-library image-processing glide kotlin java

glide-transformations's Introduction

Hi


I'm Daichi Furiya, a Google Developers Expert for Android 👨🏻‍💻 aspiring to become an Expert in the field of Mobile development. I’m also an Open-Source enthusiast with all of my projects open-sourced on Github.

coding User Image

  • 🗼 Living in Tokyo, Japan

  • 👨‍💻 Currently Working at CyberAgent and NowDo

  • 👍 Dogs and Gaming 🐶 🎮

  • ✈️ Open to Remote Job Opportunities 🍻


📈 GitHub Stats

Wasabeef's github stats Top Langs

♡ Top Sponsors

glide-transformations's People

Contributors

aakira avatar aqua-ye avatar arkar-aung avatar bigeye-wg avatar bitdeli-chef avatar devansh-maurya avatar elevenfive avatar fougere-mike avatar jason-cooke avatar satorufujiwara avatar squeeish avatar start141 avatar timusus avatar vecharm avatar wasabeef avatar yqritc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glide-transformations's Issues

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

Get transformed Bitmap array.

How can get transformed bitmaps in a sequence, I want to get bitmaps and convert it into gif.

Currently we are using below method to get bitmaps, but we are not getting bitmaps in an order.

Glide.with(this).load(ImageUtils.imageUris.get(i)).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).dontAnimate().transform(bitmapTransformation, shapeTransformation).into(new SimpleTarget<Bitmap>() {
                         @Override
                         public void onResourceReady(Bitmap arg0, GlideAnimation<? super Bitmap> arg1) {
                                  
                               }
                           }); 

A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.

Please help me! Sometimes I get this error

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:41) 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.decodeSourceFromCache(DecodeJob.java:113) at com.bumptech.glide.load.engine.EngineRunnable.decodeFromCache(EngineRunnable.java:116) at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:99) 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)

This is my code
// Load image Glide.with(context) .load("https://api.temadagar.ravla.org/" + context.getResources().getString(R.string.API_VERSION) + "/get_image.php?w=300&h=225&id=" + id) .diskCacheStrategy(DiskCacheStrategy.ALL) .thumbnail( 0.5f ) .placeholder(R.raw.day_holder) .into(((ViewHolderGrid) holder).image);

Please I need help! It's urgent

Using override with RoundedCornersTransformation

Hi,

I'm using override to set the size of the bitmap generated, it works fine, but as soon as I apply the RoundedCornersTransformation transform, the bitmap is too small and does not match the values passed in override call

Glide.with(getContext())
    .load(Uri.parse(location))
    .asBitmap()
    .transform(new RoundedCornersTransformation(getContext(), dp(6), 0))
    .override(mediaRect.width(), mediaRect.height())
    .into(mediaTarget);

I also tried with fitCenter(), same thing.

Am I doing something wrong? thanks!

Strange behaviour in RecyclerView when Using "TopCrop" transformation

I'm using the transformation:
https://github.com/wasabeef/glide-transformations/blob/master/transformations%2Fsrc%2Fmain%2Fjava%2Fjp%2Fwasabeef%2Fglide%2Ftransformations%2FCropTransformation.java

to show only the 80% of an image from the top (i want to fit the width and use the 80% of the picture height to be shown). Obviously cropCenter,fitCenter etc do not help, but this class seems so.

If I have a custom activity with two elements everythings runs fine, but when I do use in my code with recycler view, strange issues appears.
I do use glide to read a png from cache folder (no network) in the adapter (onBindView):

final int measuredWidth = viewHolder.getThumbImageView().getMeasuredWidth();

   if (tmpIssue.isDownloaded()) {
//Show the image
            File destFile = new File(statusView.getContext().getCacheDir(), tmpIssue.getName() + FileUtils.FILE_EXTENSION_PNG);
            Glide.with(statusView.getContext().getApplicationContext())
                    .load(destFile)
                    .signature(new StringSignature(FileUtils.getSha1(destFile)))                  
                    .bitmapTransform(new CropTransform(statusView.getContext().getApplicationContext(),
                                    measuredWidth,
                                    viewHolder.getThumbImageView().getMaxHeight(), CropTransform.CropType.TOP))
                 .placeholder(R.drawable.preview_bw).error(R.drawable.preview_bw).diskCacheStrategy(DiskCacheStrategy.NONE)
                    .into(viewHolder.getThumbImageView());
        } else {
            //show the placeholder
            Glide.with(statusView.getContext().getApplicationContext())
                    .load(R.drawable.preview_bw)
                    .bitmapTransform(new CropTransform(statusView.getContext().getApplicationContext(),
                            measuredWidth,
                            viewHolder.getThumbImageView().getMaxHeight(), CropTransform.CropType.TOP))
                    .placeholder(R.drawable.preview_bw).error(R.drawable.preview_bw).diskCacheStrategy(DiskCacheStrategy.NONE)
                    .into(viewHolder.getThumbImageView());
        }

and i do think it is something with view recycling.. am i Right?
Attached the result:
top two elements have a preview file and are loaded badly (no text and image takes also the white space), lower left is ok, that's the desired behaviour, lower right is an element with no preview, so it is using the "else" of the above code, loading from drawable resources...

The transform class is the one in this repo, no modifications at all

device-2016-05-16-221124

Tranformation Fit Horizontal

We have fitCenter and cropCenter transformations by default. How about a transformation 'fitHorizontal' where Image fills the width of image view and wraps the height (dynamic height). This is similar to instagram behaviour.

How to get the tranformed image ?

I want to get transformed image to upload to server. To get this, I think I have to write file with that transformed bitmap on storage. Is it the best way to do it with this library or is there any other ways ?

can't load Blur & RoundedCorners image

I wanna display blur with rounded corners image in my app, and I use following code:

public void loadBlurCornerImage(Context context, ImageView imageView, String imgUrl, int cornerRadius) { Glide.with(context) .load(imgUrl) .placeholder(R.drawable.loading_img_list_default) .error(R.drawable.loading_img_list_default) .crossFade() .priority(Priority.NORMAL) .diskCacheStrategy(DiskCacheStrategy.ALL) .bitmapTransform( new BlurTransformation(context, Contants.BLUR_VALUE), new RoundedCornersTransformation( context, cornerRadius, 0)) .into(imageView); }

but it seems that RoundedCornersTransformation doesn't work. Maybe there is something wrong.

RoundedCornersTransformation used in Adapter does not work

I use RoundedCornersTransformation in Adapter, but, sometimes it work, and sometime it cannot. why?
my code :

 public void displayImage(String url, ImageView imageView, DisplayImageOptions opts) {
        DrawableRequestBuilder<?> builder = Glide.with(imageView.getContext())
                .load(url);

        if(opts.getPlaceHolder() != 0) {
            builder.placeholder(opts.getPlaceHolder());
        }

        if(opts.getErrorImage() != 0) {
            builder.error(opts.getErrorImage());
        }

        builder.crossFade();
//        builder.diskCacheStrategy(DiskCacheStrategy.RESULT);
//        builder.dontTransform();
        if(opts.getRadius() != 0) {
            builder.bitmapTransform(/**new FitCenter(imageView.getContext()),*/
                    new RoundedCornersTransformation(imageView.getContext(),
                            opts.getRadius(), 0));
        }else {
//            builder.dontTransform();
            /**builder.bitmapTransform(new FitCenter(imageView.getContext()));*/
        }
        builder.into(imageView);
    }

Glide Transformation of GIF Image

I have a problem when try to load GIF image into an ImageView with a Circle Transformation.
If I load GIF image without transformation, the image is loaded without any problem and the GIF animation works. But, when I try to perform Circle Transformation to the image, the animation work, but the transformation (circle crop) doesn't work.

This is the GIF image:
8f20a5f825b0ef5396f766bc9c185485_128x128

And this is what I want (Image is crooped, but also it should be run):

img

And here is my code:

  Glide.with(context)
                .load(imageURL)
                .placeholder(R.drawable.default_avatar)
                .transform(new CircleTransform(context))
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(imageView);

CircleTransform

public class CircleTransform extends BitmapTransformation {
    public CircleTransform(Context context) {
        super(context);
    }

    @Override
    protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
        return circleCrop(pool, toTransform);
    }

    private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
        if (source == null) return null;

        int size = Math.min(source.getWidth(), source.getHeight());
        int x = (source.getWidth() - size) / 2;
        int y = (source.getHeight() - size) / 2;

        // TODO this could be acquired from the pool too
        Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);

        Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
        if (result == null) {
            result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
        }

        Canvas canvas = new Canvas(result);
        Paint paint = new Paint();
        paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
        paint.setAntiAlias(true);
        float r = size / 2f;
        canvas.drawCircle(r, r, r, paint);


        int borderWidth = 3;
        int borderColor = 0xffffffff;

        final Paint paint2 = new Paint();
        paint2.setAntiAlias(true);
        paint2.setColor(borderColor);
        paint2.setStrokeWidth(borderWidth);
        paint2.setStyle(Paint.Style.STROKE);
        canvas.drawCircle(source.getWidth() / 2, source.getHeight() / 2, (float) (source.getWidth() / 2 - Math.ceil(borderWidth / 2)), paint2);

        return result;
    }

    @Override
    public String getId() {
        return getClass().getName();
    }
}

RoundedCornersTransformation radius applied on image source size

When I apply the rounded corner transformation I have different visual results with the same radius input. In the following screenshot you can see two images using the same corner radius, however one has a bigger visual effect because its source size is smaller, and the image is scaled to match the area.

2016-10-16 00 37 58

Is there any way to tell the RoundedCornersTransformation to apply the radius on the destination view size rather than on the source? I think this might be related to #47 though I don't understand what's being said there.

2.0.0 BlurTransformation crashes on Android 4.2

The blur transformation in 2.0.0 crashes the app in my emulator running Android 4.2:

04-12 10:57:42.616 1987-2003/jp.wasabeef.example.glide E/RenderScript: rsi_ScriptIntrinsicCreate 5
04-12 10:57:42.616 1987-2003/jp.wasabeef.example.glide A/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=128), thread 2003 (fifo-pool-threa)

This happens both in the example app and my own app. Only using RSBlur on Android 4.3+ (wolfemm@a6cbe3c) seems to be a fix, but I'm not knowledgeable enough to know whether that's the proper solution or not.

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);

Image is not transforming

Hi, maybe I'm doing something wrong, but with big image the lib is not working.
Bitmap bitmap = Glide.with(CropActivity.this)
.load(mImageUri)
.asBitmap()
.transform(new SketchFilterTransformation(CropActivity.this))
.fitCenter()
.into(size, size)
.get();
when I am trying to load small size picture it works. But with big one it just return original image

Border image

How to use library to have a different color border for my picture?

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?

CropSquareTransformation doesn't seem to always use the Source Bitmap

In CropSquareTransformation, possibly other places too, it looks like if it finds a bitmap in the pool, of the correct dimensions and config, it wraps it and returns it and does nothing with the source bitmap.

  @Override
  public Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int outHeight) {
    Bitmap source = resource.get();
    int size = Math.min(source.getWidth(), source.getHeight());

    mWidth = (source.getWidth() - size) / 2;
    mHeight = (source.getHeight() - size) / 2;

    Bitmap.Config config =
        source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
    Bitmap bitmap = mBitmapPool.get(mWidth, mHeight, config);
    if (bitmap == null) {
      bitmap = Bitmap.createBitmap(source, mWidth, mHeight, size, size);
    } //MY COMMENT: else nothing happens with the source, it returns the bitmap from the pool

    return BitmapResource.obtain(bitmap, mBitmapPool);
  }

Using CropTransform gives a black background

Hi,

Thank you for providing excellent transformations. And I'm using CropCircleTransformation & getting cool Circular images but I'm also getting weird black background to it. I hope you can help me fix it.

circle transform not cropped properly on gif image on first load

so i am having a problem when i try to load my gif image into an imageview. the image and animation load without problem. however, as you can see on the attached image, the image is not cropped properly like it overdraws my border. and it only occurs when it loads for the first time after install, so when i closed the app and then reopen it again the image cropped properly.

screenshot_2015-06-01-16-38-26

here is my glide code, i tried to refresh the view after resource ready, but it's not solved the issue. :(

Glide.with(this)
                    .load(user.getProfilePicture())
                    .transform(new CircleTransform(this))
                    .into(new GlideDrawableImageViewTarget(ivProfilePicture) {
                        @Override
                        public void onResourceReady(GlideDrawable drawable, GlideAnimation anim) {
                            super.onResourceReady(drawable, anim);
                            ivProfilePicture.setImageDrawable(drawable);
                            ivProfilePicture.invalidate();
                            ivProfilePicture.requestLayout();
                        }
                    });

and this is the layout code

<RelativeLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:padding="1dp"
                        android:id="@+id/lay_profpic"
                        android:layout_gravity="center"
                        android:layout_margin="20dp"
                        android:background="@drawable/border_circle">

                        <ImageView
                        android:id="@+id/profile_picture"
                        android:scaleType="centerCrop"
                            android:layout_centerHorizontal="true"
                            android:src="@color/white"
                            android:layout_gravity="center"
                        android:layout_width="90dp"
                        android:layout_height="90dp" />
                    </RelativeLayout>

How to Crop images to Aspect ratio

The square transformation lets you crop the image to an aspect ratio of 1:1. However, what if I want to crop the image to other aspect ratios like 16:9, 16:8 and so on. Is there any way I can achieve this using this library?

Regards

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);

Out of Memory

when it loads image using recyclerView, it causes out of memory. Need to solve this

Duplicate files copied in APK lib/x86/librsjni.so

Error:Execution failed for task ':App:packageDebug'.

Duplicate files copied in APK lib/x86/librsjni.so
File 1: /Users/admin/workspace/myapp/App/build/intermediates/exploded-aar/jp.wasabeef/glide-transformations/1.3.1/jni/x86/librsjni.so
File 2: /Users/admin/Library/Android/sdk/build-tools/21.1.2/renderscript/lib/packaged/x86/librsjni.so

scaleType conflict with MaskTransformation

Thanks for the great library!

I am using the MaskTransformation and noticed that if scaleType was set (in my case, to center), the MaskTransformation would have no effect.

This wouldn't impact my use case but wondering why it would be like this.

Thanks.

Transformations don't work at random

Hello.

I am using Glide 3.7.0 and bumped into this issue. I am loading images into RecyclerView items, using 2 transformations as follows:

			Context context = ivProfilePhoto.getContext();
			Glide.with(context).load(url)
					.bitmapTransform(
							new CircleBorderTransformation(context, borderThickness, borderColor),
							new CropCircleTransformation(context)
					)
					.into(ivProfilePhoto);

The images are loaded just fine, but transformations are not performed at random. Here's the screenshot of the results i'm getting. Any help is appreciated. Thank you.
screenshot_151

Error using with Proguard

Hey,

I tried to compile one of my projects using Proguard but it unfortunately failed. It would be great if you could provide a Proguard config file.

Cheers!

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

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);

Issue with conforming to layout params. Transform has mind of its own

I specify width and height that I want my imageview to be, and somewhere along the way, the transformation overwrites it.

I primarily only want rounded corners. my images can come down from the network in any aspect ratio, and my imageview is supposed to be a landscape rectangle (with rounded corners), with the bitmap set to centerCrop scaleType. So I'd like the transform not to do anything to that. Thoughts?

How transform placeholder?

bitmapTransform only edits the image into "load" not "placeholder", Is there a way to transform the placeholder?

Random crashes in BlurTransformation using renderscript

Tried adding a new BlurTransformation(context, BLUR_SIZE); transform to a listview with many graphical elements. Randomly when I scroll up/down I get stack-less traces. The debug log shows only a native renderscript library crash at some point:

10-17 11:46:06.944 32483-32483/****.**** D/ImagePostTarget: Did load thumbnail!
10-17 11:46:06.956 276-276/? I/DEBUG: [2016-10-17 11:46:06.956]
10-17 11:46:06.956 276-276/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-17 11:46:06.956 991-1497/? W/NativeCrashListener: Couldn't find ProcessRecord for pid 1530015793
10-17 11:46:06.956 276-276/? I/DEBUG: Build fingerprint: 'lge/jagnm_global_com/jagnm:5.0.2/LRX22G.A1440040099/152321208d526:user/release-keys'
10-17 11:46:06.956 276-276/? I/DEBUG: Revision: '6'
10-17 11:46:06.956 276-276/? E/DEBUG: AM write failure (32 / Broken pipe)
10-17 11:46:06.956 276-276/? I/DEBUG: ABI: 'arm'
10-17 11:46:06.956 276-276/? I/DEBUG: pid: 32483, tid: 2483, name: RSMessageThread  >>> ****.**** <<<
10-17 11:46:06.957 276-276/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xba8
10-17 11:46:06.967 991-1786/? I/ActivityManager: Start proc com.android.externalstorage for content provider com.android.externalstorage/.ExternalStorageProvider: pid=2488 uid=10005 gids={50005, 9997, 1028, 1015, 1023} abi=armeabi-v7a
10-17 11:46:06.978 276-276/? I/DEBUG:     r0 00000000  r1 96587b0c  r2 00000000  r3 00000000
10-17 11:46:06.979 276-276/? I/DEBUG:     r4 00000000  r5 13c91ca0  r6 765cd000  r7 00000000
10-17 11:46:06.979 276-276/? I/DEBUG:     r8 13903e10  r9 b043d800  sl 139d50c0  fp 00000000
10-17 11:46:06.979 276-276/? I/DEBUG:     ip a959cf08  sp 96587af8  lr 73dbb5fd  pc b66aeb6c  cpsr 600b0030
10-17 11:46:06.979 276-276/? I/DEBUG: backtrace:
10-17 11:46:06.979 276-276/? I/DEBUG:     #00 pc 0001eb6c  /system/lib/libRS.so (android::renderscript::Context::initToClient()+11)
10-17 11:46:06.979 276-276/? I/DEBUG:     #01 pc 001125fb  /system/framework/arm/boot.oat
10-17 11:46:07.050 991-1023/? D/sensors_hal_Time: time_service_sensor1_cb: msg_type 2
10-17 11:46:07.050 991-1023/? D/sensors_hal_Time: time_service_sensor1_cb: Sn 24, msg Id 3, txn Id 0
10-17 11:46:07.050 991-1023/? D/sensors_hal_Time: tsOffsetIs: Apps: 6134425653362; DSPS: 201098642; Offset : -2627626316

While running attached to Android Studio I get console logs like:

V/RenderScript: Successfully loaded runtime: libRSDriver_adreno.so
V/RenderScript: 0xb041fe00 Launching thread(s), CPUs 4
V/RenderScript: 0x9e429a00 Launching thread(s), CPUs 4
V/RenderScript: 0x9d4ea600 Launching thread(s), CPUs 4
V/RenderScript: Successfully loaded runtime: libRSDriver_adreno.so
V/RenderScript: Successfully loaded runtime: libRSDriver_adreno.so
V/RenderScript: Successfully loaded runtime: libRSDriver_adreno.so
V/RenderScript: 0xb0417200 Launching thread(s), CPUs 4

                --------- beginning of crash
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xba8 in tid 15411 (RSMessageThread)
V/RenderScript: Successfully loaded runtime: libRSDriver_adreno.so
V/RenderScript: 0xb041fe00 Launching thread(s), CPUs 4
Disconnected from the target VM, address: 'localhost:8604', transport: 'socket'

Removing the blur transform (I have other chained like rounded corners) makes the app solid again and not crashable. This suggests there is a bug in the renderscript implementation of the blur transform. Not sure how this can be debugged, posting here for suggestions. Tested devices include Android 5.x and 6.x.

CropTransformation is not working

Hi thanks for this library.
I'm trying to use CropTransformation but nothing happen

Glide.with(context).load(arrImages.get(savedResource).getImgSrc())
.bitmapTransform( new CropTransformation(context,200,200)).
.into(mainImage);

ty

Transparency issue

In the source bitmap doesn't support transparency, the resulted transformed bitmap will have black borders due to original config.

Bitmap.Config config = source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;

Taken from circle transformation.

Is that desired behaviour for transformed images?

Use Glide Transform Display Image for problem

/**
* 圆角
*
* @param path
* @param imageView
* @param placeHolder
* @param corners 角度
*/
private static void setCropCircleTransformationImage(String path, final ImageView imageView, final int placeHolder, int corners) {
if (TextUtils.isEmpty(path)) {
imageView.setImageResource(placeHolder);
return;
}
Glide.with(BaseApplication.mApp).load(path).bitmapTransform(new RoundedCornersTransformation(BaseApplication.mApp, getDp(corners), 0, RoundedCornersTransformation.CornerType.ALL)).crossFade(1000).placeholder(placeHolder).into(imageView);
}

public static int getDp(int n) {
    final float scale = BaseApplication.mApp.getResources().getDisplayMetrics().density;
    return (int) (n * scale + 0.5f);
    // int margin = (int) (10 * scale + 0.5f); // 10dp
    // int width = (int) (160 * scale + 0.5f); // 160dp
    // int height = (int) (90 * scale + 0.5f); // 90dp
}

the Rounded Corners Stretching Vague ;

What is the reason for Transformation<Bitmap> instead of BitmapTransformation?

While supporting Glide issues any time I look at your codebase this question comes into my mind. It's time to ask. :)

There's some handy logic included in the built-in BitmapTransformation in Glide, what is the reason for not using that? It would reduce some boilerplate in all the transformations and the transformation can be more widely used because of the more specific type (some Glide APIs handle BitmapTransformation).

Also note the Target.SIZE_ORIGINAL handling.

Library including the GPUImage library

From what I have been able to tell, you're library automatically includes the GPUImage library.
It shows up in the exploded-aar as well when your code is compiled.
It would be nice to fix this, my project has armeabi code in it, but doesn't have 64-bit support and since GPUImage includes 64-bit support, this resulted in the other library in my project not being found. I couldn't only exclude GPUImage as your library included it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.