I am trying to create a bitmap from an int array, but the resulting bitmap is all 0.
Scenario I have an app which takes a raw image and then does some post processing on the raw image. After this processing, I am trying to save the resulting byte array as a JPEG image and here is where I am converting the array to a bitmap so that it can be saved as a JPG.
int  rgbArray = getColor( returnValue ); // converts the image to an int array Bitmap image = Bitmap.createBitmap( rgbArray, 1008, 758, Bitmap.Config.ARGB_8888 );
image has every pixel set to 0 and the resulting Jpeg is all black. I wonder if you can give any pointers as to why this should be the case?
I tried printing out the various get functions from the Bitmap to see if it gives any clue.
Bitmap getHeight() 758 Bitmap getWidth() 1008 Bitmap describeContents() 0 Bitmap getByteCount() 3056256 Bitmap getConfig() ARGB_8888 Bitmap isRecycled() false Bitmap isPremultiplied() true Bitmap hasAlpha() true Bitmap getColorSpace() sRGB IEC61966-2.1 (id=0, model=RGB)
I am new to android programming, so any pointers would be extremely helpful. Thanks in advance.
Update If I
setPremultiplied( false ); for the Bitmap, it works fine. I guess my immediate problem is solved if i set Premultiplied to false.