Is it possible to set Android Camera resolution?

Asked

Viewed 328 times

4

I am developing an Android application, and would like to know if it would have how to make my application when calling the camera pass the resolution values of Photo, ex: 1024 X 1024?

  • It is possible to set resolution to video as well?

1 answer

5


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

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

Example of implementation:

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

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

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

Note: I never used this functionality, but in the documentation it says that it works.

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

  • I’ll check here, and try to do this way

  • 1

    @Gomes, do not forget that you have to use a resolution among those who return in the method getSupportedPictureSizes(), because from what I saw if you use something outside of it the app will give crash.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.