glide
An image loading and caching library for Android focused on smooth scrolling
Top Related Projects
A powerful image downloading and caching library for Android
An Android library for managing images and the memory they use.
Powerful and flexible library for loading, caching and displaying images on Android.
Image loading for Android and Compose Multiplatform.
An Android transformation library providing a variety of image transformations for Glide.
Implementation of ImageView for Android that supports zooming, by various touch gestures.
Quick Overview
Glide is a fast and efficient image loading library for Android. It offers a simple, flexible API for loading, displaying, and caching images from various sources, including network, local storage, and resources. Glide is optimized for smooth scrolling and minimal memory usage.
Pros
- High performance and efficient memory management
- Seamless integration with Android's lifecycle
- Supports various image formats and sources
- Extensive customization options and transformations
Cons
- Learning curve for advanced features
- Large library size compared to some alternatives
- Limited support for animated GIFs on older Android versions
- Some features require additional dependencies
Code Examples
Loading an image into an ImageView:
Glide.with(context)
.load("https://example.com/image.jpg")
.into(imageView)
Loading an image with placeholder and error handling:
Glide.with(context)
.load("https://example.com/image.jpg")
.placeholder(R.drawable.loading_spinner)
.error(R.drawable.error_image)
.into(imageView)
Applying transformations to an image:
Glide.with(context)
.load("https://example.com/image.jpg")
.transform(CircleCrop())
.transform(BlurTransformation(25))
.into(imageView)
Getting Started
- Add Glide to your project's
build.gradle
file:
dependencies {
implementation 'com.github.bumptech.glide:glide:4.15.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.15.1'
}
- Add internet permission to your
AndroidManifest.xml
:
<uses-permission android:name="android.permission.INTERNET" />
- Use Glide in your Activity or Fragment:
import com.bumptech.glide.Glide
// ...
Glide.with(this)
.load("https://example.com/image.jpg")
.into(imageView)
Competitor Comparisons
A powerful image downloading and caching library for Android
Pros of Picasso
- Simpler API and easier to use for basic image loading tasks
- Smaller library size, which can be beneficial for apps with strict APK size constraints
- Built-in support for OkHttp, making it a good choice for projects already using Square's networking library
Cons of Picasso
- Less flexible caching options compared to Glide
- Fewer advanced features and customization options
- Generally slower image loading performance, especially for larger images
Code Comparison
Picasso:
Picasso.get()
.load("https://example.com/image.jpg")
.into(imageView);
Glide:
Glide.with(context)
.load("https://example.com/image.jpg")
.into(imageView);
Both libraries offer similar basic usage, but Glide provides more options for customization and optimization. Glide's with()
method allows for better context management and lifecycle awareness, while Picasso's simpler API may be sufficient for basic use cases.
Overall, Picasso is a good choice for simpler projects with basic image loading needs, while Glide offers more advanced features and better performance for complex applications with extensive image handling requirements.
An Android library for managing images and the memory they use.
Pros of Fresco
- Better memory management, especially for large images
- Supports progressive JPEG loading
- More customizable image pipeline
Cons of Fresco
- Larger library size, potentially increasing app size
- Steeper learning curve due to more complex API
- Limited support for GIF animations compared to Glide
Code Comparison
Glide:
Glide.with(context)
.load(url)
.into(imageView);
Fresco:
Uri uri = Uri.parse(url);
SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI(uri);
Glide offers a simpler API for basic image loading, while Fresco requires more setup but provides greater control over the image loading process. Glide's syntax is more concise and intuitive for simple use cases, whereas Fresco's approach with DraweeViews offers more flexibility for complex scenarios.
Both libraries are widely used and maintained, with Glide being more popular due to its ease of use and Fresco being favored for its advanced features and performance optimizations. The choice between them often depends on specific project requirements and the level of control needed over image loading and display.
Powerful and flexible library for loading, caching and displaying images on Android.
Pros of Android-Universal-Image-Loader
- More flexible configuration options for advanced use cases
- Supports a wider range of image sources, including file system and assets
- Easier to implement custom caching strategies
Cons of Android-Universal-Image-Loader
- Less actively maintained compared to Glide
- Slightly more complex API, requiring more setup code
- Lower performance in some scenarios, especially with large image sets
Code Comparison
Android-Universal-Image-Loader:
ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
imageLoader.displayImage(imageUrl, imageView, options);
Glide:
Glide.with(context)
.load(imageUrl)
.into(imageView);
Android-Universal-Image-Loader requires more setup code and configuration, while Glide offers a simpler, more concise API for basic image loading tasks. Glide's syntax is more modern and aligns better with current Android development practices.
Both libraries are capable of handling common image loading scenarios, but Glide has become more popular due to its ease of use, better performance, and active maintenance. Android-Universal-Image-Loader may still be preferred in specific cases where its additional flexibility is required.
Image loading for Android and Compose Multiplatform.
Pros of Coil
- Written in Kotlin, providing better integration with Kotlin-based Android projects
- Smaller library size, reducing APK size and improving app performance
- Built-in support for Jetpack Compose, making it easier to use in modern Android development
Cons of Coil
- Newer library with a smaller community and fewer resources compared to Glide
- May lack some advanced features and customization options available in Glide
- Potentially less stable due to its shorter development history
Code Comparison
Glide:
Glide.with(context)
.load(imageUrl)
.placeholder(R.drawable.placeholder)
.into(imageView)
Coil:
imageView.load(imageUrl) {
placeholder(R.drawable.placeholder)
}
Both libraries offer similar functionality for loading images, but Coil's syntax is more concise and idiomatic in Kotlin. Glide requires a separate builder pattern, while Coil uses Kotlin's extension functions for a more streamlined approach.
Coil is designed to be a modern alternative to Glide, focusing on Kotlin-first development and integration with newer Android technologies. While it offers advantages in terms of size and Kotlin compatibility, Glide remains a more mature and feature-rich option with a larger ecosystem.
An Android transformation library providing a variety of image transformations for Glide.
Pros of glide-transformations
- Provides a wide range of image transformations and filters
- Easy integration with existing Glide implementations
- Allows for chaining multiple transformations
Cons of glide-transformations
- Adds additional dependency to the project
- May increase app size due to extra transformation libraries
- Potential performance overhead for complex transformations
Code Comparison
Glide (basic usage):
Glide.with(context)
.load(url)
.into(imageView);
glide-transformations (with transformation):
Glide.with(context)
.load(url)
.transform(new BlurTransformation(25))
.into(imageView);
Summary
Glide is a powerful image loading library for Android, focusing on smooth scrolling and efficient memory usage. glide-transformations extends Glide's functionality by providing a collection of image transformations and filters. While glide-transformations offers more creative options for image manipulation, it comes at the cost of increased project complexity and potential performance impact. Developers should consider their specific requirements when deciding whether to incorporate glide-transformations into their Glide-based projects.
Implementation of ImageView for Android that supports zooming, by various touch gestures.
Pros of PhotoView
- Specialized for image zooming and panning functionality
- Simpler integration for basic photo viewing needs
- Lightweight library focused on a specific use case
Cons of PhotoView
- Limited to image viewing and manipulation
- Lacks advanced image loading and caching features
- Requires additional libraries for network image loading
Code Comparison
PhotoView implementation:
PhotoView photoView = findViewById(R.id.photo_view);
photoView.setImageResource(R.drawable.image);
Glide implementation:
ImageView imageView = findViewById(R.id.image_view);
Glide.with(this).load("http://example.com/image.jpg").into(imageView);
Key Differences
PhotoView is a specialized library for adding zoom and pan functionality to images, while Glide is a comprehensive image loading and caching library. PhotoView excels in providing a smooth zooming experience but lacks advanced image loading capabilities. Glide, on the other hand, offers robust image loading, caching, and transformation features but doesn't inherently provide zooming functionality.
PhotoView is ideal for applications that require detailed image inspection, such as photo galleries or document viewers. Glide is better suited for apps that need efficient image loading and caching across various sources, like social media feeds or e-commerce product listings.
For projects requiring both advanced image loading and zooming capabilities, developers often use Glide in conjunction with PhotoView to achieve the desired functionality.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Glide
| View Glide's documentation | ç®ä½ä¸æææ¡£ | Report an issue with Glide
Glide is a fast and efficient open source media management and image loading framework for Android that wraps media decoding, memory and disk caching, and resource pooling into a simple and easy to use interface.
Glide supports fetching, decoding, and displaying video stills, images, and animated GIFs. Glide includes a flexible API
that allows developers to plug in to almost any network stack. By default Glide uses a custom HttpUrlConnection
based
stack, but also includes utility libraries plug in to Google's Volley project or Square's OkHttp library instead.
Glide's primary focus is on making scrolling any kind of a list of images as smooth and fast as possible, but Glide is also effective for almost any case where you need to fetch, resize, and display a remote image.
Download
For detailed instructions and requirements, see Glide's download and setup docs page.
You can download a jar from GitHub's releases page.
Or use Gradle:
repositories {
 google()
mavenCentral()
}
dependencies {
 implementation 'com.github.bumptech.glide:glide:4.16.0'
}
Or Maven:
<dependency>
<groupId>com.github.bumptech.glide</groupId>
<artifactId>glide</artifactId>
<version>4.16.0</version>
</dependency>
For info on using the bleeding edge, see the Snapshots docs page.
R8 / Proguard
The specific rules are already bundled into the aar which can be interpreted by R8 automatically
How do I use Glide?
Check out the documentation for pages on a variety of topics, and see the javadocs.
For Glide v3, see the wiki.
Simple use cases will look something like this:
// For a simple view:
@Override public void onCreate(Bundle savedInstanceState) {
...
ImageView imageView = (ImageView) findViewById(R.id.my_image_view);
Glide.with(this).load("https://goo.gl/gEgYUd").into(imageView);
}
// For a simple image list:
@Override public View getView(int position, View recycled, ViewGroup container) {
final ImageView myImageView;
if (recycled == null) {
myImageView = (ImageView) inflater.inflate(R.layout.my_image_view, container, false);
} else {
myImageView = (ImageView) recycled;
}
String url = myUrls.get(position);
Glide
.with(myFragment)
.load(url)
.centerCrop()
.placeholder(R.drawable.loading_spinner)
.into(myImageView);
return myImageView;
}
Status
Version 4 is now released and stable. Updates are released periodically with new features and bug fixes.
Comments/bugs/questions/pull requests are always welcome! Please read CONTRIBUTING.md on how to report issues.
Compatibility
- Minimum Android SDK: Glide v4 requires a minimum API level of 14.
- Compile Android SDK: Glide v4 requires you to compile against API 26 or later.
If you need to support older versions of Android, consider staying on Glide v3, which works on API 10, but is not actively maintained.
- OkHttp 3.x: There is an optional dependency available called
okhttp3-integration
, see the docs page. - Volley: There is an optional dependency available called
volley-integration
, see the docs page. - Round Pictures:
CircleImageView
/CircularImageView
/RoundedImageView
are known to have issues withTransitionDrawable
(.crossFade()
with.thumbnail()
or.placeholder()
) and animated GIFs, use aBitmapTransformation
(.circleCrop()
will be available in v4) or.dontAnimate()
to fix the issue. - Huge Images (maps, comic strips): Glide can load huge images by downsampling them, but does not support zooming and panning
ImageView
s as they require special resource optimizations (such as tiling) to work withoutOutOfMemoryError
s.
Build
Building Glide with gradle is fairly straight forward:
git clone https://github.com/bumptech/glide.git
cd glide
./gradlew jar
Note: Make sure your Android SDK has the Android Support Repository installed, and that your $ANDROID_HOME
environment
variable is pointing at the SDK or add a local.properties
file in the root project with a sdk.dir=...
line.
Samples
Follow the steps in the Build section to set up the project and then:
./gradlew :samples:flickr:run
./gradlew :samples:giphy:run
./gradlew :samples:svg:run
./gradlew :samples:contacturi:run
You may also find precompiled APKs on the releases page.
Development
Follow the steps in the Build section to setup the project and then edit the files however you wish. Android Studio cleanly imports both Glide's source and tests and is the recommended way to work with Glide.
To open the project in Android Studio:
- Go to File menu or the Welcome Screen
- Click on Open...
- Navigate to Glide's root directory.
- Select
setting.gradle
For more details, see the Contributing docs page.
Getting Help
To report a specific problem or feature request, open a new issue on Github. For questions, suggestions, or anything else, email Glide's discussion group, or join our IRC channel: irc.freenode.net#glide-library.
Contributing
Before submitting pull requests, contributors must sign Google's individual contributor license agreement.
Thanks
- The Android team and Jake Wharton for the disk cache implementation Glide's disk cache is based on.
- Dave Smith for the GIF decoder gist Glide's GIF decoder is based on.
- Chris Banes for his gradle-mvn-push script.
- Corey Hall for Glide's amazing logo.
- Everyone who has contributed code and reported issues!
Author
Sam Judd - @sjudd on GitHub, @samajudd on Twitter
License
BSD, part MIT and Apache 2.0. See the LICENSE file for details.
Disclaimer
This is not an official Google product.
Top Related Projects
A powerful image downloading and caching library for Android
An Android library for managing images and the memory they use.
Powerful and flexible library for loading, caching and displaying images on Android.
Image loading for Android and Compose Multiplatform.
An Android transformation library providing a variety of image transformations for Glide.
Implementation of ImageView for Android that supports zooming, by various touch gestures.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot