Bitmap.Config differences with/without alpha channel on a canvas
I am drawing some Bitmaps to a canvas. Some (most) of these bitmaps utilize the alpha channel, and transparency/translucency is critical for the image to look correct. This is necessary due to some image manipulation I perform throughout the Activity
.
Eventually the user is finished with their task and I take the canvas and save it to a PNG via use of this method:
Bitmap.createBitmap(this.getWidth(), this.getHeight(), Bitmap.Config.ARGB_8888);
At this point I no longer make any modifications to the canvas/image but I do display the image to a Canvas
in another Activity
. I wa开发者_StackOverflow社区nt it to look exactly the same as in the previous Activity
, so does it matter if I use Bitmap.Config.RGB_565
instead or will I lose information?
You will definitely lose information if you use Bitmap.Config.RGB_565. It may not be discernible on a phone display, but you're going from 24 bits of color information (not counting alpha) to 16 bits of color information when you go from RGB_8888 to RGB_565. Instead of 256 distinct red, green, and blue values in RGB_8888, there are only 64 distinct green values and 32 distinct red and blue values in RGB_565. This may cause banding or other sorts of quantization artifacts in your RGB_565 image.
精彩评论