Create an empty raster map with the dimensions of the source image and the format ARGB_8888:
int width = src.getWidth();
int height = src.getHeight();
Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Copy pixels from the original bitmap to the int array:
int[] pixels = new int[width * height];
src.getPixels(pixels, 0, width, 0, 0, width, height);
And set these pixels to the target bitmap:
dest.setPixels(pixels, 0, width, 0, 0, width, height);
source
share