What is the best pixel format
Android offers the option of using different bitmap configurations for bitmaps. A bitmap configuration describes how the pixels are stored in the file. This affects the quality (e.g. color depth) and the ability to display transparent colors.
Android distinguishes 4 different Bitmap.Config types
With the Bitmap.Config ALPHA_8, each pixel is saved as a single alpha channel. This configuration requires 1 byte of memory for each pixel of the image. This can be useful for saving masks efficiently.
Bitmap.Config ARGB_4444 has been deprecated since API level 13. Because of the poor quality of this configuration, you should do without the Bitmap.Config ARGB_4444 and use ARGB_8888 instead.
All 4 channels in the image (RGB and Alpha) are saved with an 8-bit precision. This configuration is very flexible and offers the best quality. Since each pixel is stored in 4 bytes, this configuration requires a lot of memory and a lot of computing power to process the image data. Therefore, ARGB_8888 should be used if the highest quality and transparency is required.
With the RGB_565 pixel format, each pixel is saved in 2 bytes and only the RGB channels are available. RGB_565 bitmaps do not contain any transparency.
- Red is saved with 5 bit precision (32 possible values)
- Green is saved with 6 bit precision (64 possible values)
- Blue is saved with 5 bit precision (32 possible values)
RGB_565 can be useful when using bitmaps that do without transparency and do not require high color depth. The advantage of RGB_565 is that these bitmaps can be drawn faster and require significantly less memory.
In my experiments I observed an approx. 15% better performance.
Create RGB_565 file with Gimp
Creating RGB_565 JPGs is not that easy. For Photoshop, for example, there is an extra plug-in for this task. But since I'm a Gimp user, that doesn't help me much.
However, there is also a way to create an image in Gimp that is saved as RGB_565. In Gimp you have to do that dither16bit.scm script and the following 4 pallets are installed.
Download the pallets:
The 4 palettes must be copied to the% GIMP_HOME% / share / gimp / 2.0 / palettes / folder. If the pallets are available, you can see the following 4 new pallets in the “Pallets” dialog.
Now the dither16bit.scm script has to be copied into the folder% GIMP_HOME / share / gimp / 2.0 / scripts. Unfortunately there is no refresh button here and Gimp has to be restarted once before the plugin can be used. Then you will find the following menu items in the menu with which you can convert your image into an RGB_565 bitmap.
Everyone has to decide for themselves which pixel format best suits their own requirements. In any case, I will use the format more often in the future. In most cases, 65536 different colors are enough for me if, for example, I need a drawable for a button or another component.
- What is Bulgaria's policy on Brexit
- What's the newest language
- Enter female soldiers
- A longer lifespan extends social change
- Satan is a god of war
- To which country do the Azores belong
- What is the Credibility of Internshala Certifications
- What is all the tone scale music
- What are muslin wraps used for?
- What is the breakpoint in Python
- What is a good coin to buy
- A negative pH value is possible
- Game computers are offered for sale
- Will PayPal resolve the cause of Bitcoin?
- What does XR stand for
- How do you buy Twitch followers
- What is the contact number of the BHU
- How does CPWD recruit engineers
- What are some national holidays in Denmark
- James Holzhauer is Indian
- Do alpha particles have a mass?
- What is problem complexity
- What are your BTS messages for today
- How does Vocaloid change your voice?