Android Bitmap Comprehensive Analysis (four) image processing effect comparison ...

Source: Internet
Author: User

Compare objects: UIL Volley The method in the official tutorial (as described in this series of tutorials, the imageloader approach is the same as the official one)
------------------------------------------------------------------------
First of allcompression processing of single picture, but also focus on the analysis of a small demo (the end will release the download connection) copy the corresponding calculation method, and then calculate the dozens of sets of data, the original width of the image is a 10000 of the random integer, the limit size is 400 200, and then compression processing, 10 sets of data are recorded as follows
The control scaling type Fit_inside and crop are detailed in the UIL Framework analysis in tutorial three-1, where it's easy to say Fit_inside is the default control display type, and the picture is displayed completely inside the control, not necessarily filling the control crop is making the picture fill the entire control, The picture may not show the full effect. You can build a ImageView in Android project without setting the zoom type (ie fit_inside effect), then build a scaletype to crop the same size control, and then display the same picture, you will see the difference between

The official/volley/imageloader does not differentiate between scaling types, so the final compressed picture is a size result under different scaling types we can also see that the official algorithm is the same as the UIL crop type, which essentially ensures that the image is wide and high after compression.all have toGreater than or equal to the limit of the width of the volley of the kind of limited value of the special treatment, the final effect is to let the compressed image width highany oneGreater than or equal to the width height, then the fit_inside effect corresponding to UIL

What kind of good?(only for compression processing of pictures)UILWe have long and detailed analysis (tutorial series three-1), for the scaling type of processing is very accurate,is obviously the best ~(so many people use not unreasonable) that contrast, the official handling and volley of each have insufficient ~
official=uil CROP is the official processing method is more suitable for the CROP zoom type of picture display However, in the processing of large and wide-aspect ratio of the picture, if the fit_inside display mode, it will result in a slightly larger compressed picture, although the display quality can be guaranteed, But waste a small amount of memory resources such as the first set of data, 664 3640 of the compression results, obviously and we need 400 200 difference is too large-brain repair is probably the match box and Watermelon knife bar (not too accurate ~)
Volley=uil Fit_inside on behalf of volley more suitable for the picture display by default, so when dealing with a picture with a wide aspect ratio that is too large, if it is a crop scale type, the compression size looks pretty much the same, but actually the display does not work as expected. Size we can see it from the size value, show the effect I still have to make a real picture of the people look at it (you can download the demo project at the end of the article)

Desperate to find a microblog long chart experiment, the project altogether four ImageView control, the above two is volley, the bottom row is UIL, the left two is fit_inside effect, the right is crop and I said volley in too big wide height difference, With the crop type display can not achieve the expected quality of the effect, is the upper right corner of this figure, it is simply that I do not wear glasses to see the world drops in comparison, UIL in the treatment of crop the effect is very secure ~
There's a condition for all of the above shortcomingsthe difference between the aspect ratio is too high,Because most of the situation, the original image of the aspect ratio is relatively stable, and our limit values are similar, most of the situation is set to a square of the limited size, the original image is almost square rectangle ~ This explains why most of the picture frames, including the official tutorials, do not specifically differentiate between different zoom types, because, in general, where the length-to-width ratio is not stable, the official type of simple processing is the applicable reference to the above data we can also be drawn, when the original length and width ratio and the limit aspect ratio of the more similar, Then two different algorithms (official and UIL crop is one, volley and UIL Fit_inside is another) the smaller the difference, when the original image and the limit value of the aspect ratio is very similar or even equal, the two algorithms will eventually be the same (such as the red bold part of the data) And we look at the difference between the length and width of the first group of data and the second-to-last group of data, the difference between the two algorithms is directly 2^4=16 times ~ Everyone is interested in trying to get some of the larger proportion of the special value to try
------------------------------------------------------------------------
Picture Color StyleContrast volley wrote Dead is Rgb_565imageloader no settings, that should be the default Argb_8888uil provisioning API, the default is also argb_8888
------------------------------------------------------------------------
Cache PoolCompare volley only interface ... None of the instance classes, but it's easy to write. Imageloader is mainly Tanqiang reference, single soft reference two UIL offers 8 types, weak and strong, separate and mixed, including different algorithms
The difference lies in the difference between soft and weak references, this direct look at tutorial two for different reference types of introduction on the line, you can also Baidu search, in fact, the difference is not strong reference parts are similar, even using the latest LRUCache class, Actually look at the source code we will also find inside or with LINKEDHASHMAP implementation
------------------------------------------------------------------------


In summary, it must be UIL completely win, there are a lot of expansion function part is also UIL more powerful did not run
But volley framework we have said before, although the function is not perfect, but very suitable for us two times development
Imageloader, a little bit simpler, you can learn the source of the small practiced hand to use


------------------------------------------------------------------------
Last drop Finally, the demo is a brief introduction under the Drawable package has a large aspect ratio of the micro-bo long map, there is a normal close to the square diagram, code only one class, the inside of several compression algorithms are posted out, the test method has been written, we can modify the numerical calculation, You can also copy some pictures to see the effect of other proportions of the picture layout file corresponding to only one, the inside put 4 ImageView, two ordinary, two center_crop, that is, the corresponding crop scaling type, control scaling type and UIL frame scaling type of the corresponding relationship, Refer to tutorial three-1 in UIL Introduction

Enough beans drip direct download, not enough to reply to the Display network disk, address failure can be private contact me

Visitors, if you want to view this post hidden content, please reply


Span style= "font-family: Microsoft Jacob Black;" >---------------------------------------------------------------------------

series chain Connect Android Bitmap Full Resolution (i) load large size picture
Http://www.eoeandroid.com/thread-331669-1-1.html

Android Bitmap Full parsing (ii) loading of multiple images cache processing
Http://www.eoeandroid.com/thread-332399-1-1.html

Android Bitmap Full Parsing (iii) Open source image framework Analysis 1-uil (top)
Http://www.eoeandroid.com/thread-333220-1-1.html

Android Bitmap Full Parsing (iii) Open source image framework Analysis 1-uil (next)
http://www.eoeandroid.com/thread-333229-1-1.html  Android Bitmap Full parsing (iii) Open source image framework analysis 2-imageloader and volleyhttp://www.eoeandroid.com/thread-334315-1-1.html Android Bitmap Comprehensive Analysis (iv) Image processing effect comparisonHttp://www.eoeandroid.com/thread-334752-1-1.html



--------------------------------------------------------------------------- 

(End scatter
the end of this series, the comments I will see most of them, the problem is to be re-edited to modify the post to complete the
< Span style= "font-size:medium;" > there is a volley two times package, the estimated length will be too large, later may open a series of stickers, I hope you support more


all original, so reprint hope to indicate the source, but also the author information: Boredream transliteration Dream    transliteration of the Chrysanthemum

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.