Reputation: 4179
I was looking to convert the Raw Image data (like .DNG extension) to JPG format using Android. There is a similar app in Playstore
Can anyone provide me some clue or any open source code to do same.
[EDIT] I have already tried THIS using Visual C++ and able to develop the Application for Windows OS.
The stuff I am looking for Android.
Upvotes: 2
Views: 4492
Reputation: 2681
You can use bitmap from raw image.
And for that you can extend every byte to 32-bit ARGB int. A is alpha 0xff and R G B are pixel values.
Try following code.
Source
is byte array of Raw image.
byte [] Source; //Comes from somewhere...
byte [] Bits = new byte[Source.length*4]; //That's where the ARGB array goes.
int i;
for(i=0;i<Source.length;i++)
{
Bits[i*4] =
Bits[i*4+1] =
Bits[i*4+2] = ~Source[i]; //Invert the source bits
Bits[i*4+3] = -1;//0xff, that's the alpha.
}
//Now put these nice ARGB pixels into a Bitmap object
Bitmap bm = Bitmap.createBitmap(Width, Height, Bitmap.Config.ARGB_8888);
bm.copyPixelsFromBuffer(ByteBuffer.wrap(Bits));
Or library is available here. But you need to use ndk for same.
Upvotes: 2