Bitmap.config RGB

Source: Internet
Author: User

1024*1024 argb_8888 to 4M figure

Android large pictures are generally compressed to show, otherwise prone to oom, generally we compress only attention to its size dimensions, 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_8
public static final Bitmap.config argb_4444
public static final Bitmap.config argb_8888
public static final Bitmap.config rgb_565

A look, a little blindfolded, alpha_8, argb_4444,argb_8888,rgb_565 in the end what is it?

In fact, this is the color of the storage method: We know that ARGB refers to a color model, where a for Alpha,r said Red,g said Green,b said Blue, in fact, all the visible color is the right red and green blue, so red and green blue is also called the three primary colors, Each primary color stores the information values of the colors represented

In plain alpha_8, Alpha is made up of 8 bits.
The argb_4444 is made up of 4 4-bit, or 16-bit,
The 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;

Bitmap.config RGB

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.