Is it possible to set Android Camera resolution?

4

I'm developing an Android application, and would like to know if I could have my application when calling the camera pass the resolution values of Photo, eg: 1024 X 1024 ?

    
asked by anonymous 17.07.2014 / 13:41

1 answer

5

I never used this functionality, but already studying other features of the Camera, I saw that there was such a possibility.

There is a method in Camera.Parameters , which is called setPictureSize (int width, int height) follow the link of the feature documentation.

Implementation example:

Parameters parameters = camera.getParameters();
parameters.set("jpeg-quality", 70);
parameters.setPictureFormat(PixelFormat.JPEG);
parameters.setPictureSize(2048, 1232);
camera.setParameters(parameters);
  

Obs¹: You should only use image sizes that are available from getSupportedPictureSizes() . Using anything else can crash the application.

List<Camera.Size> sizes = parameters.getSupportedPictureSizes();
  

Obs2: I have never used this functionality, but in the documentation it says it works.

     

Edit: According to @Gomes this worked for the case.

    
17.07.2014 / 13:53