The answer of Uttam didnt work for me. I just got null when I do: Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata, 0, bitmapdata.length); In my case, bitmapdata only has the buffer of the pixels, so it is imposible for the function decodeByteArray to guess which the width, the height and the color bits use. So I tried this and it worked: //Create bitmap with width, height, and 4 bytes color (RGBA) Bitmap bmp = Bitmap.createBitmap(imageWidth, imageHeight, Bitmap.Config.ARGB_8888); ByteBuffer buffer = ByteBuffer.wrap(bitmapdata); bmp.copyPixelsFromBuffer(buffer); Check for different color options.

Thanks dear @lapheal could you please explain more about it: Marshal.Copy(ptr, x, 0, bytes); and after using this code, can i modify byte array directly? Hi, please open this link: you will see the example code to tell you how to modify the data of image.

Byte array to bitmap

The simplest way is to pin the array: GCHandle handle = GCHandle.Alloc(bufferarray, GCHandleType.Pinned); get the pointer to the array IntPtr iptr = Marshal.UnsafeAddrOfPinnedArrayElement(bufferarray, 0); then create a new bitmap using the IntPtr: bitmap = new Bitmap(width, height, (width * 4).

Marshal.Copy(.) mean copy data from memory pointer to byte array, and then you can change the data in your byte array x. When you finish change the data, you will need to use bitmap.UnlockBits function to save the changed data back to bitmap. Anyway, please take a look at that link, I think you will get it. Thanks dear @lapheal could you please explain more about it: Marshal.Copy(ptr, x, 0, bytes); and after using this code, can i modify byte array directly? Hi, please open this link: you will see the example code to tell you how to modify the data of image.

Marshal.Copy(.) mean copy data from memory pointer to byte array, and then you can change the data in your byte array x. When you finish change the data, you will need to use bitmap.UnlockBits function to save the changed data back to bitmap. Jine laga hu pahle se jyada mp3skull. Anyway, please take a look at that link, I think you will get it.