data.getExtras().get(“data”) result of low resolution image in android

前端 未结 2 798
别那么骄傲
别那么骄傲 2020-12-06 10:39

In my app I take a picture from camera and then I get that picture to do some image processing operations on same picture but when I get this picture with data.getExtras().g

相关标签:
2条回答
  • 2020-12-06 10:57

    Mightier nailed it. Without including extras you only get a small sized image. From the Android documentation:

    public static final String ACTION_IMAGE_CAPTURE Since: API Level 3

    Standard Intent action that can be sent to have the camera application capture an image and return it.

    The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT.

    0 讨论(0)
  • 2020-12-06 11:05

    Before broadcasting intent, you should include extras to it:

    intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri);
    

    where imageFileUri could be output file name on SD card:

    imageFileUri=Uri.parse("file:///sdcard/picture.jpg");
    

    That would save image to known location and after taking image you would be able to process it.

    0 讨论(0)
提交回复
热议问题