$30 off During Our Annual Pro Sale. View Details »

Android Image Loading Libs

Android Image Loading Libs

Ersin Ertan

July 10, 2015
Tweet

More Decks by Ersin Ertan

Other Decks in Programming

Transcript

  1. Image Loaders Intro
    github.com/facebook/fresco
    /bumptech/glide
    /square/picasso

    View Slide

  2. Considerations:
    ● Memory consumption of displayed image
    ● what is cached
    ● API features
    ● library size and method counts
    ● web services like: Thumbor -smart image
    detection, on-demand crop, resizing and
    flipping of images

    View Slide

  3. Keep In Mind
    Default behaviours can be modified to be more
    or less like the other.

    View Slide

  4. Image Standards: GIF / WebP / JPG
    WebP(lossy and lossless compression for photographic,
    translucent and graphical images)
    Open sourced by Google
    WebP 24-bit RGB color, 8-bit alpha
    GIF's 8-bit color, 1-bit alpha
    Animated GIFs to lossy WebPs (64% smaller), lossless
    WebPs (19% smaller)
    More CPU time for memory trade off, smaller than JPEG
    with no noticeable difference

    View Slide

  5. General Features:
    ● resizing
    ● cropping
    ● image shape transformation
    ● placeholder and error images
    ● thumbnail support
    ● lifecycle integration
    ● scroll update speed

    View Slide

  6. Fresco
    “Images stored in ashmem heap(The anonymous shared
    memory (ashmem), subsystem uses a Unix-y, file-based,
    shared memory interface to user-space, which may
    implement caching and similar resource management that
    efficiently integrates with kernel memory management.”
    animated GIF and WebP images, progressive jpeg
    streaming, default HttpURLConnection, can integrate
    OkHttp to pipeline
    MVC: DraweeHierarchy, DraweeView, DraweeController

    View Slide

  7. Glide
    Image loading would be integrated with Activity/Fragment's
    lifecycle
    RGB_565 (50% less memory) with slight visual artifacts
    caches ImageView’s size image per use case(more
    memory)
    can use OkHttp
    ModelLoader provides view size, allowing for configurable
    url selection
    Emphasis on smooth scroll

    View Slide

  8. Picasso
    ARGB_8888 - same memory consumption
    when both use ARGB
    caching full image then resizes(more
    processing)
    no GIF but WebP
    automatically uses OkHttp if found as
    dependency

    View Slide

  9. Examples

    View Slide

  10. https://github.com/ersin-ertan
    https://plus.google.com/+ErsinErtan1
    Ersin Ertan

    View Slide