JonathanNet
JonathanNet

Reputation: 1697

Android Glide BlurTransformation

Hi I cannot get Glide BlurTransformation to work, I used Picasso before as you can see on the image, but I get an error with Glide, I also tried to use .apply(bitmapTransform(BlurTransformation(20, 3))) but same error, so how can I get it to work with the newest version of Glide and BlurTransmation?

https://i.sstatic.net/vFwES.jpg

                                Glide.with(getApplicationContext())
                                        .load(rCoverImg)
                                        .transform(new BlurTransformation(getApplicationContext(), 20, 3))
                                        .centerCrop()
                                        .into(mBinding.profileCover);

                                Picasso.with(getApplicationContext())
                                        .load(rCoverImg)
                                        .transform(new BlurTransformation(getApplicationContext(), 20, 3))
                                        .into(mBinding.profileCover);

Upvotes: 1

Views: 4798

Answers (1)

AskNilesh
AskNilesh

Reputation: 69689

The BlurTransformation() required two parameters First is radius and second is sampling

check this screen shot for source code BlurTransformation()

enter image description here

if You want to use Glide the use this

    Glide.with(getApplicationContext())
            .load("https://i.sstatic.net/K8FFo.jpg?s=328&g=1")
            .transform(new BlurTransformation( 20, 3))
            .centerCrop()
            .into((mBinding.profileCover);

Make sure you have correct imports for Glide

import com.bumptech.glide.Glide;
import jp.wasabeef.glide.transformations.BlurTransformation;

UPDATE

    Glide.with(getApplicationContext())
            .load("https://i.sstatic.net/K8FFo.jpg")
            .apply(new RequestOptions().centerCrop())
            .transform(new BlurTransformation( 20, 2))
            .into(myImageView);

If you want use Picasso then

Use this

Picasso.get()
       .load(rCoverImg)
       .transform(new BlurTransformation(getApplicationContext(), 20, 3))
       .into(mBinding.profileCover);

Instead of this

Picasso.with(getApplicationContext())
       .load(rCoverImg)
       .transform(new BlurTransformation(getApplicationContext(), 20, 3))
       .into(mBinding.profileCover);

Upvotes: 4

Related Questions