Change camera resolution setting programmatically in android

帅比萌擦擦* 提交于 2019-12-03 15:19:48
Zaid Daghestani

You must add an MediaStore.EXTRA_OUTPUT to the intent. In the extra, you have to specify a Uri for the picture to be saved to. This will save the full resolution image, otherwise, it will just snap a small image.

Refer to the Android docs: ACTION_IMAGE_CAPTURE

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

Vipul Purohit

I think its not possible see the link below :

Open Android Camera in lower resolution with ACTION_IMAGE_CAPTURE

You have to manually set the resolution from camera preview screen.

If you are getting small snap even if your camera resolution is set to high then use Zed Scio's approach.

You can use this method to get all supported sizes of pictures.

public List<Camera.Size> getSupportedPictureSizes ()

You will get a List of supported Picture Sizes. And then from this, you can set whichever size you want to using this method.

public void setPictureSize (int width, int height)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!