Introduction to Glide, Image Loader Library for Android

What is glide?
Library used to download the image in android app.

Advantage:
1. fast and efficient
2. Use less memory and disk space.
3. Very easy to implement.
4. support animated Gif file
5. Using in the list is very efficient.
6. In the latest version glide 3.7.0 fix the memory leak for gif files
7. Fix issue in releasing the memory while calling clear memory.
8. Having different method for clearing diskcache and also separate method to set.
9. Also we can also increase Glide’s Image Quality (builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888))
10. Having many options like loading images from resources, file and from Uri.
11. the clarity of the image while comparing to picasso, Gilde have more clarity of image and also memory utilisation is very low.
12. Glide loads an image to memory and do the caching is better than Picasso which let an image loaded far faster
13. Automatic job cancellation in lists where views are re-used.

Below methods are very useful while comparing to other image downloading library.
.setMemoryCache(MemoryCache memoryCache)
.setDiskCache(DiskCache.Factory diskCacheFactory)
.setDiskCacheService(ExecutorService service)
.setResizeService(ExecutorService service)

  • In the passed Google Developer Summit Thailand, Google introduced us an Image Loader Library for Android developed by bumptech named Glide as a library that recommended by Google,
  • Must say that it looks 90% similar to Picasso

Import to project

Both Picasso and Glide are on jcenter. You can simply import it to your project with dependency like this:

Picasso :

dependencies {
compile ‘com.squareup.picasso:picasso:2.5.1’
}

Glide :

dependencies {
compile ‘com.github.bumptech.glide:glide:3.5.2’
compile ‘com.android.support:support-v4:22.0.0’
}

Please don’t forget to import support-v4 to your project like above as well.

Basic

Picasso :

Picasso.with(context)
.load(“http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg”)
          .into(ivImg);

Glide :

Glide.with(context)
          .load(“http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg”)
          .into(ivImg);

Although it looks quite the same but in details Glide is designed far better since with doesn’t accept only Context but also Activity and Fragment. Context will be automatically extracted from those things you throw in.

glide_1

Features:

A lmost all the same things just like Picasso can do with the same style of coding for example

Image Resizing :

// Picasso
.resize(300, 200);

// Glide
.override(300, 200);

Center Cropping:

// Picasso
.centerCrop();

// Glide
.centerCrop();

Transforming:

// Picasso
.transform(new CircleTransform())

// Glide
.transform(new CircleTransform(context))

Placeholder and Error image:

// Picasso
.placeholder(R.drawable.placeholder)
.error(R.drawable.imagenotfound)

// Glide
          .placeholder(R.drawable.placeholder)
.error(R.drawable.imagenotfound)

Difference image loader’s: 

glide_2

 

Android Team,
Mallow Technologies.

Leave a Reply

%d bloggers like this: