I open the camera of the Android device by default, conveying the intention. Therefore, when an image is captured, by default the camera saves it in JPEG format. But I do not want to store them in a lossy format. I want image quality to be high. So, how can I save it in PNG format? ...
here is my code to open the camera:
Date dt = new Date();
int date=dt.getDate();
int hours = dt.getHours();
int minutes = dt.getMinutes();
int seconds = dt.getSeconds();
String curTime = date+"_"+hours + "_"+minutes + "_"+ seconds;
_path=Environment.getExternalStorageDirectory() +"/"+curTime+".jpg";
File file = new File( _path );
Uri outputFileUri = Uri.fromFile( file );
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
context.startActivityForResult(intent,0);
Then process onActivutyForResult () {....}
Thanks Sneha
source
share