Android picture Compression quality parameters Bitmap.config rgb_565 and so on meaning

Source: Internet
Author: User

Android Image Compression Quality parameters

In the utility Imageloader, when configuring displayimageoptions, you need to set the. Bitmapconfig (Bitmap.Config.RGB_565)

So what does this Bitmap.Config.RGB_565 mean?


Large pictures in Android generally have to be compressed to display, otherwise prone to oom, generally we compress only attention to its size, in fact, in addition to the size, the impact of a picture occupies space and its color details .


Open the Android.graphics.Bitmap class has an inner class Bitmap.config class, in the Bitmap class CreateBitmap (intwidth, int height , Bitmap.config Config) method will be used, open a look at this class

Enumeration variables
public static final Bitmap.config alpha_8public static final bitmap.config argb_4444public static final Bitmap.config ARGB _8888public Static Final Bitmap.config rgb_565

It's kind of covered.Alpha_8argb_4444argb_8888rgb_565What is it?

In fact, this is the color of the storage method: We know that ARGB refers to a color pattern, where a for Alpha, R for Red, G for Green, b for Blue , in fact , all the visible color is the right red and green blue, so red and green blue is also known as the three primary colors, each primary color is stored the value of the information expressed


To be blunt is actually:

Alpha_8 is that Alpha is made up of 8 bits .

argb_4444 is made up of 4 4-bit, or 16-bit,

argb_8888 is made up of 4 8-bit, or 32-bit,

rgb_565 is R is 5 bits, G is 6 bits, B is 5 bits total 16 bits


Thus:

Alpha_8 represents a 8-bit alpha bitmap

argb_4444 represents a 16-bit ARGB bitmap

argb_8888 represents a 32-bit ARGB bitmap

rgb_565 represents a 8-bit RGB bitmap

The higher the number of bitmap bits, the more color information they can store, and the more realistic the image will be.


Usage:

Set the value of option before compressing:

Options.inpreferredconfig = Bitmap.Config.RGB_565;


Android picture Compression quality parameters Bitmap.config rgb_565 and so on meaning

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.