How To Convert .raw File To Image File In Android Rooted Device Programmatically
I am trying to create a screenshot capturing app in android which capture screen shot of device screen by using adb command programmatically. I have tried every link from stack ove
Solution 1:
Android cannot do that by itself. You need a external decoder. There are libraries which can decode, demosaicing, whitebalance etc and convert to RGB. This is a digital negative and needs a lot of image processing before its viewable in Android.
Check out dcraw, its a library for decoding all types of RAW-files.
Solution 2:
if raw is image file then u can change extentention to jpg or png,
Filess=newFile(ssDir, "ss.raw");
change this to
Filess=newFile(ssDir, "ss.jpg");
but capturing screenshots require root permission to execute su permission
File f = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "screeshot.jpg");
Process localProcess = Runtime.getRuntime().exec("su");
OutputStream os = localProcess .getOutputStream();
//DataOutputStream dos = (DataOutputStream) localProcess.getOutputStream();
os.write(("/system/bin/screencap -p " + f.toString()).getBytes("ASCII"));
//dos.writeBytes("exit\n");
os.flush();
os.close();
localProcess .waitFor();
Post a Comment for "How To Convert .raw File To Image File In Android Rooted Device Programmatically"