Fresco, Glide, Picasso difference comparison and analysis

First of all, compare Picasso and Glide.
In general, the two are very similar and have almost the same API style, but Glide is slightly better in caching strategy and loading gif. Here is a detailed analysis of Picasso and Glide.

1. The usage of the two is similar, but Glide's with() accepts not only Context, but also Activity or Fragment, and Context will be automatically obtained from them. At the same time, the advantage of using Activity/Fragment as the parameter of with() is that the image loading will be consistent with the life cycle of Activity/Fragment. For example, when the Paused state is suspended, it will automatically reload when it is Resumed. So I suggest passing Activity and Fragment to Glide instead of Context when passing parameters.

2. The quality of the picture loaded by Glide is slightly worse than that of Picasso, why is this? This is because Glide's default Bitmap format is RGB_565, which has half the memory overhead of the ARGB_8888 format. Of course, Glide can also set the format through GlideModule.

3. The two have very different disk caching strategies. Picasso caches the full size, while Glide caches the same size as the ImageView. The advantage of Glide's approach is that the loading display is very fast. The Picasso way, however, introduces some delay as it needs to be resized before being displayed.

4. Glide can load GIF animations, but Picasso cannot.

5. The size of Picasso (v2.5.1) is about 118KB, while the size of Glide (v3.5.2) is about 430KB. Picasso has about 480 methods, while Glide has about 2678 methods.

Secondly, it is Fresco

There is a module called Image Pipeline designed in Fresco. It is responsible for loading images from the network, from the local file system, from local resources. To maximize space and CPU time savings, it has a 3-level cache design (2 levels of memory, 1 level of disk).

There is a module called Drawees designed in Fresco, which will display a placeholder image before the image is loaded, and automatically replace it with the target image after the image is loaded successfully. When the picture is no longer displayed on the screen, it will release the memory and space occupied in time.

Fresco features:
Memory management

The decompressed image, that is, the Bitmap in Android, takes up a lot of memory. A large memory footprint will inevitably lead to more frequent GC. Below 5.0, GC will significantly cause the interface to freeze.

On systems below 5.0, Fresco places images in a special memory area. Of course, when the picture is not displayed, the occupied memory will be released automatically. This will make the APP smoother and reduce OOM caused by image memory usage.

Fresco performs equally well on low-end machines, and you no longer have to think about the memory usage of images.

·Picture drawing

Fresco's Drawees design brings some useful features:

1. Customize the center focus

2. Fillet diagrams, of course circles are also fine

3. After the download fails, click to reproduce the download

4. Customize placeholder image, custom overlay, or progress bar

5. Specify the overlay when the user presses

·Image loading

Fresco's Image Pipeline allows you to customize the image loading process in many ways, such as:

1. Specify a different remote path for the same picture, or use a picture that already exists in the local cache

2. Display a low-resolution picture first, and then display the high-resolution picture after the high-resolution picture is downloaded

3. Loading complete callback notification

4. For this map, if there is an EXIF ​​thumbnail, the thumbnail can be displayed before the large image is loaded

5. Zoom or rotate the picture

6. Process the downloaded pictures again

7. Support WebP decoding, it can be used normally even on the Android system that did not fully support WebP earlier!

·Gift loading

Loading Gif images and WebP animations is a very headache in the eyes of any Android developer. Each frame is a large Bitmap, and each animation has many frames. Fresco frees you from these worries, it handles every frame and manages your memory well.

· Progressive rendering of pictures

The progressive JPEG image format has been popular for several years. The progressive image format first presents a rough outline of the image, and then as the image download continues, it presents a gradually clearer image. This has a great impact on mobile devices, especially on slow networks. Good, can bring better user experience.

Having said so much, in short, Fresco is hanging!

Finally, let's summarize
the functions that Picasso can achieve and Glide can do, but the required settings are different. The difference between the two is that Picasso is much smaller than Glide and has higher image quality than Glide, but Glide is faster than Picasso. The advantage of Glide is to process large image streams, such as gif and video. If you want to make video applications, Glide as the first choice.

Fresco can be said to have integrated the advantages of the previous image loading library. Its memory optimization below 5.0 is very good, but its shortcoming is that the volume is too large. Compared by volume: Fresco>Glide>Picasso, so Fresco is in the picture with more Its value can be highlighted in the application. If the application does not have too many image requirements, it is not recommended to use Fresco.

Guess you like

Origin blog.csdn.net/hongranzuoxiang/article/details/119325299