9

I'm new to android developing. In my app, I have a horizontalScrollView that contains images. Later I have been using Picasso to load images from URL. Then I heard about glide so I switched to glide and now my image loading is fast but the quality of images is too low.

code below

//load image from URL 1.1
        ivImageFromURL = (ImageView) findViewById(R.id.videoconwmimage);
        Glide.with(this).load("http://imgur.com/KtfpVUb.png").into(ivImageFromURL);
Zoe
  • 27,060
  • 21
  • 118
  • 148
Simon
  • 461
  • 1
  • 5
  • 23

4 Answers4

32

If you are using Glide v4, then when making Glide requests, change

Glide.with(imageView).load(url).into(imageView);

to

Glide.with(imageView).load(url)
    .apply(new RequestOptions()
            .fitCenter()
            .format(DecodeFormat.PREFER_ARGB_8888)
            .override(Target.SIZE_ORIGINAL))
    .into(imageView);

That did the trick for me without having to add anything to the manifest. It might help to also add android:adjustViewBounds="true" to your ImageView in XML. The classes are

import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
Leo Aso
  • 11,898
  • 3
  • 25
  • 46
2

This is because Glide default Bitmap Format is set to RGB_565 since it consumed just 50% memory footprint compared to ARGB_8888 used by Picasso.

you can fix it making following changes:

public class GlideConfiguration implements GlideModule {

    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        // Apply options to the builder here.
        builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
    }

    @Override
    public void registerComponents(Context context, Glide glide) {
        // register ModelLoaders here.
    }
}

And add following to your manifest:

<meta-data android:name="com.inthecheesefactory.lab.glidepicasso.GlideConfiguration"
            android:value="GlideModule"/>

For more details visit here

nnn
  • 980
  • 6
  • 13
1

Please check this link

Glide loads with lower image quality

https://github.com/bumptech/glide/issues/1227

vinod
  • 1,126
  • 13
  • 18
0

Glide uses RGB_565 not to use too much memory. If defaults dont seem fine to you, you can use Glide.Builder and set builder.setDecodeFormat(DecodeFormat.ALWAYS_ARGB_8888); as your preferred configuration.

https://github.com/bumptech/glide/wiki/Configuration check the link.

anzaidemirzoi
  • 386
  • 4
  • 13