Reputation: 1068
I'm using camera intent to capture image inside my android app. After capturing I save pics into mobile internal/External storage in a specific folder. The problem is that these pics are not being saved in that resolution which camera has normally, their resolution is very low.
here is my code
Intent intent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
Bitmap bp = (Bitmap) data.getExtras().get("data");
/*********** Load Captured Image And Data Start ****************/
String extr = Environment.getExternalStorageDirectory().toString()
+ File.separator + "ScannerMini";
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
.format(new Date());
imageName = timeStamp + ".jpg";
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
myPath = new File(getExternalFilesDir(filepath), imageName);
//File myPath = new File(extr, imageName);
}
else{
myPath = new File(extr, imageName);
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(myPath);
bp.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
MediaStore.Images.Media.insertImage(getApplicationContext()
.getContentResolver(), bp, myPath.getPath(), imageName);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
can anybody tell me that what should i do to save image in original resolution. Any help would be much appreciated. Thank You :)
Upvotes: 1
Views: 774
Reputation: 10323
Bitmap bp = (Bitmap) data.getExtras().get("data");
By doing this you will only get a thumbnail image. You need to specify MediaStore.EXTRA_OUTPUT
option in your capture intent. This is a path where captured image will be stored. Refer to android docs Taking Photos Simply
Upvotes: 3