Ricardo Cunha
Ricardo Cunha

Reputation: 2075

Android Camera SurfaceView. How to Change Picture Resolution?

I´m trying to change the resolution of the camera when I using a surfaceview. I´m using a implementation like this: url . My camera has a 2592 x 1944 pixels resolution, but when I get byte[] from Camera and then convert to a Bitmap the Bitmap has 2048 x 1536. There is a way to change this?

Upvotes: 3

Views: 3502

Answers (1)

user658042
user658042

Reputation:

You have to change the camera parameters; in this case with Camera.Parameters.setPictureSize().

The basic workflow here is

Camera.Parameters cp = mCamera.getParameters(); // get the current params
cp.set...(); // change something
mCamera.setParameters(cp); // write the params back

mCamera is your camera object in this case.
This is also documented in the Camera class documentation. under step 2 and 3.

Make sure that every resolution that you set via this function is supported. You can get a list of the resolutions that are supported on a device via Camera.Parameters.getSupportedPictureSizes().

Upvotes: 2

Related Questions