Facebook launches powerful Android Image library fresco automatically frees memory image cache memory Benefits

Source: Internet
Author: User
Tags webp

automatically frees up memory! Facebook launches powerful Android Image library fresco

Fast and efficient display of images is extremely important for Android devices, but in the past few years we have faced a lot of problems in effectively storing images. The picture is too big, and the phone has only a small amount of memory, especially the Android device to partition the memory to each application. Therefore, too many pictures will always consume most of the memory, resulting in the application crash.

To address this issue, Facebook recently launched a powerful picture library fresco for displaying images in Android apps that can load images from the Web, local storage, and local resources. And, to save data and CPU, it has a level three cache. In addition, Fresco uses drawees in the display aspect, and can display placeholders until the picture is loaded. When the picture disappears from the screen, it automatically releases the memory that the image occupies. Fresco supports Android version 2.3 and above and is currently hosted on GitHub.



Key Features:

    • Memory

The uncompressed image and the Android bitmap occupy a lot of memory, which causes the Java garbage collector to run more frequently and makes the application more slow, especially on Android 5.0, which does not have a perfect garbage collector.

In Android 4.x and below, fresco places pictures in a special location on Android memory. This ensures that when images are not displayed on the screen, they can automatically release the memory they occupy. Make your app run faster and less prone to crashes.

With fresco apps, even on low-end devices, you don't have to worry about the memory footprint of your pictures.

    • Streaming

Progressive (Progressive) JPEG images on the web have been around for many years, and in the process of opening a file, the blurred outlines of the entire image are displayed first, and as the number of scans increases, the picture becomes clearer. This format can be said to be the savior of the slow network situation, through the outline of the picture to know what the picture is about to be loaded.

Android's own picture library does not support streaming, and fresco can simply specify a URI, and your application will automatically update its display as the data arrives.

    • Animation

Animated GIFs and WEBP should be difficult to apply, with each frame being a large bitmap, and each animation a series of frames. The fresco is responsible for loading and processing these frames and managing their memory.

    • Drawing

Fresco uses Drawees,fresco drawees in display to display placeholders until the picture is loaded and automatically displayed when the image arrives:

    • Extend the picture to a custom focus, rather than as the center of the process.
    • Use a rounded or rounded shape to display the image.
    • If the network fails to load, the user can click the placeholder to reload the image.
    • Displays a custom background, a floating window widget (overlays), or a progress bar on an image.
    • When the user clicks on the picture, customize the Floating window widget.
    • Load

Fresco's image pipeline allows you to customize the load in a variety of ways:

    • Specifies a different URI for an image from which to select a display that has already been cached.
    • A low-resolution image is prioritized to switch to a high resolution when the data arrives.
    • If the image has an EXIF thumbnail, the thumbnail is displayed first, until the entire picture is loaded (only for local images).
    • Adjusts or rotates the image.
    • Even in the older version of Android can also decode WEBP images, but not all support.
Github:https://github.com/facebook/fresco

api:http://fresco-cn.org/

Facebook launches powerful Android Image library fresco automatically frees memory image cache memory Benefits

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.