Convert Figma logo to code with AI

facebook logofresco

An Android library for managing images and the memory they use.

17,071
3,749
17,071
230

Top Related Projects

18,705

A powerful image downloading and caching library for Android

34,576

An image loading and caching library for Android focused on smooth scrolling

10,628

Image loading for Android and Compose Multiplatform.

Powerful and flexible library for loading, caching and displaying images on Android.

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

18,764

Implementation of ImageView for Android that supports zooming, by various touch gestures.

Quick Overview

Fresco is an Android library for managing images and their memory usage. It's designed to efficiently load, display, and cache images in Android applications, with a focus on performance and memory optimization. Fresco supports various image formats and sources, including network, local storage, and content providers.

Pros

  • Efficient memory management, reducing OutOfMemoryErrors
  • Supports progressive JPEG loading for faster image display
  • Customizable image pipeline with support for various image formats
  • Automatic memory and disk caching for improved performance

Cons

  • Steeper learning curve compared to simpler image loading libraries
  • Larger library size, which may increase app size
  • Some features may be overkill for simple image loading needs
  • Limited customization options for certain advanced use cases

Code Examples

Loading an image from a URL:

SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI("https://example.com/image.jpg");

Loading an image with a placeholder and error image:

ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
    .setProgressiveRenderingEnabled(true)
    .build();

DraweeController controller = Fresco.newDraweeControllerBuilder()
    .setImageRequest(request)
    .setOldController(draweeView.getController())
    .build();

draweeView.setController(controller);

Applying image transformations:

RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f);
roundingParams.setBorder(Color.GRAY, 1.0f);
roundingParams.setRoundAsCircle(true);

GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
    .setRoundingParams(roundingParams)
    .build();

draweeView.setHierarchy(hierarchy);

Getting Started

  1. Add Fresco to your project's build.gradle:
dependencies {
    implementation 'com.facebook.fresco:fresco:2.6.0'
}
  1. Initialize Fresco in your Application class:
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Fresco.initialize(this);
    }
}
  1. Use SimpleDraweeView in your layout:
<com.facebook.drawee.view.SimpleDraweeView
    android:id="@+id/my_image_view"
    android:layout_width="130dp"
    android:layout_height="130dp" />
  1. Load an image in your Activity or Fragment:
SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI("https://example.com/image.jpg");

Competitor Comparisons

18,705

A powerful image downloading and caching library for Android

Pros of Picasso

  • Simpler API and easier to integrate into existing projects
  • Smaller library size, leading to reduced APK size
  • Better support for GIF animations out of the box

Cons of Picasso

  • Less memory efficient for large images compared to Fresco
  • Fewer advanced features for image manipulation and caching
  • Limited support for progressive JPEG loading

Code Comparison

Picasso:

Picasso.get()
    .load("https://example.com/image.jpg")
    .into(imageView);

Fresco:

Uri uri = Uri.parse("https://example.com/image.jpg");
draweeView.setImageURI(uri);

Both libraries offer simple ways to load and display images, but Fresco requires more setup in the application's initialization phase. Picasso's API is more straightforward for basic use cases, while Fresco provides more advanced features and control over the image loading process.

Picasso is generally easier to integrate into existing projects due to its simpler API and smaller footprint. However, Fresco offers better memory management for large images and more advanced features for image manipulation and caching. The choice between the two depends on the specific requirements of your project and the level of control you need over image loading and display.

34,576

An image loading and caching library for Android focused on smooth scrolling

Pros of Glide

  • Simpler API and easier to integrate into existing projects
  • Smaller library size, leading to reduced APK size
  • Better support for GIF animations and thumbnail generation

Cons of Glide

  • Less efficient memory management compared to Fresco
  • Fewer advanced features for image processing and customization
  • Limited support for progressive JPEG loading

Code Comparison

Glide:

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

Fresco:

Uri uri = Uri.parse(url);
draweeView.setImageURI(uri);

Both Glide and Fresco are popular image loading libraries for Android, but they have different strengths. Glide offers a more straightforward API and smaller library size, making it easier to integrate into existing projects. It also provides better support for GIF animations and thumbnail generation.

However, Fresco excels in memory management and offers more advanced features for image processing and customization. It also provides better support for progressive JPEG loading, which can be beneficial for slower network connections.

In terms of code, Glide's implementation is slightly more verbose but offers more flexibility, while Fresco's approach is more declarative and requires less boilerplate code.

Ultimately, the choice between Glide and Fresco depends on the specific requirements of your project and the trade-offs you're willing to make in terms of features, performance, and ease of use.

10,628

Image loading for Android and Compose Multiplatform.

Pros of Coil

  • Lightweight and simple API, easier to integrate and use
  • Built with Kotlin coroutines, offering better performance and memory efficiency
  • Supports Jetpack Compose out of the box

Cons of Coil

  • Less mature and battle-tested compared to Fresco
  • Fewer advanced features and customization options
  • Smaller community and ecosystem

Code Comparison

Coil:

ImageView(contentDescription = null).load("https://example.com/image.jpg") {
    crossfade(true)
    placeholder(R.drawable.placeholder)
}

Fresco:

SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI("https://example.com/image.jpg");

Coil offers a more concise and Kotlin-friendly syntax, while Fresco requires more setup but provides finer control over image loading and caching. Coil's API is more intuitive for modern Android development, especially when using Jetpack Compose. Fresco, being more established, offers a wider range of features and optimizations, particularly for complex image manipulation scenarios.

Both libraries provide efficient image loading and caching, but Coil's lightweight nature and Kotlin-first approach make it increasingly popular for new projects. Fresco, backed by Facebook, remains a robust choice for apps with complex image requirements or those already using other Facebook libraries.

Powerful and flexible library for loading, caching and displaying images on Android.

Pros of Android-Universal-Image-Loader

  • Simpler implementation and easier to use for basic image loading tasks
  • More lightweight and has a smaller footprint in terms of app size
  • Offers more flexibility in customizing caching strategies

Cons of Android-Universal-Image-Loader

  • Less performant for complex image manipulations and animations
  • Lacks advanced features like image transcoding and progressive loading
  • Not actively maintained, with the last update in 2016

Code Comparison

Android-Universal-Image-Loader:

ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage(imageUri, imageView);

Fresco:

SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI(uri);

Summary

Android-Universal-Image-Loader is simpler to use and more lightweight, making it suitable for basic image loading tasks. However, it lacks the advanced features and performance optimizations of Fresco, especially for complex image manipulations. Fresco offers better memory management, progressive loading, and is actively maintained by Facebook. The choice between the two depends on the specific requirements of your project, with Android-Universal-Image-Loader being a good option for simpler apps and Fresco being more suitable for apps with complex image handling needs.

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

Pros of glide-transformations

  • Lightweight and focused on image transformations
  • Easy integration with existing Glide implementations
  • Wide variety of ready-to-use transformations

Cons of glide-transformations

  • Limited to Glide library, not as versatile as Fresco
  • Lacks advanced memory management features
  • Doesn't support progressive image loading

Code Comparison

Fresco:

Uri uri = Uri.parse("https://example.com/image.jpg");
SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI(uri);

glide-transformations:

Glide.with(this)
    .load("https://example.com/image.jpg")
    .transform(new BlurTransformation(25))
    .into(imageView);

glide-transformations is a specialized library for applying transformations to images loaded with Glide, while Fresco is a more comprehensive image loading and caching library. glide-transformations offers a simpler API for transformations but lacks some of the advanced features and flexibility of Fresco. The choice between the two depends on the specific requirements of your project and whether you need a full-featured image loading solution or just transformation capabilities.

18,764

Implementation of ImageView for Android that supports zooming, by various touch gestures.

Pros of PhotoView

  • Simpler and more lightweight, focusing specifically on image viewing and zooming
  • Easier to integrate into existing projects due to its focused functionality
  • More straightforward API for basic image viewing tasks

Cons of PhotoView

  • Limited to image viewing and zooming, lacking advanced features like caching and network fetching
  • Less actively maintained compared to Fresco
  • Fewer options for customization and advanced image processing

Code Comparison

PhotoView:

PhotoView photoView = findViewById(R.id.photo_view);
photoView.setImageResource(R.drawable.image);

Fresco:

SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI("https://example.com/image.jpg");

PhotoView focuses on providing a simple way to display and zoom images, while Fresco offers a more comprehensive solution for image loading, caching, and display. PhotoView is ideal for projects that require basic image viewing functionality, whereas Fresco is better suited for applications needing advanced image handling capabilities.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Fresco

Fresco Logo

Build Status License

Fresco is a powerful system for displaying images in Android applications.

Fresco takes care of image loading and display, so you don't have to. It will load images from the network, local storage, or local resources, and display a placeholder until the image has arrived. It has two levels of cache; one in memory and another in internal storage.

In Android 4.x and lower, Fresco puts images in a special region of Android memory. This lets your application run faster - and suffer the dreaded OutOfMemoryError much less often.

Fresco also supports:

  • streaming of progressive JPEGs
  • display of animated GIFs and WebPs
  • extensive customization of image loading and display
  • and much more!

Find out more at our website.

Requirements

Fresco can be included in any Android application.

Fresco supports Android 2.3 (Gingerbread) and later.

Using Fresco in your application

If you are building with Gradle, simply add the following line to the dependencies section of your build.gradle file:

implementation 'com.facebook.fresco:fresco:3.2.0'

For full details, visit the documentation on our web site, available in English and Chinese:

Join the Fresco community

Please use our issues page to let us know of any problems.

For pull requests, please see the CONTRIBUTING file for information on how to help out. See our documentation for information on how to build from source.

License

Fresco is MIT-licensed.