List of usage examples for android.hardware.camera2 CaptureRequest JPEG_QUALITY
Key JPEG_QUALITY
To view the source code for android.hardware.camera2 CaptureRequest JPEG_QUALITY.
Click Source Link
Compression quality of the final JPEG image.
85-95 is typical usage range.
Range of valid values:
1-100; larger is higher quality
This key is available on all devices.
From source file:com.obviousengine.android.focus.ZslFocusCamera.java
/** * Request a single image.//from www . j a va2s . co m * * @return true if successful, false if there was an error submitting the * capture request. */ private boolean sendSingleRequest(FocusCamera.PhotoCaptureParameters params) { Timber.v("sendSingleRequest()"); try { CaptureRequest.Builder builder; builder = device.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE); builder.addTarget(previewSurface); // Always add this surface for single image capture requests. builder.addTarget(captureImageReader.getSurface()); builder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO); addFlashToCaptureRequestBuilder(builder, params.flashMode); addRegionsToCaptureRequestBuilder(builder); builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO); builder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE); // Tag this as a special request which should be saved. builder.setTag(RequestTag.EXPLICIT_CAPTURE); if (CAPTURE_IMAGE_FORMAT == ImageFormat.JPEG) { builder.set(CaptureRequest.JPEG_QUALITY, (byte) (JPEG_QUALITY)); builder.set(CaptureRequest.JPEG_ORIENTATION, Utils.getJpegRotation(params.orientation, characteristics)); } captureSession.capture(builder.build(), captureManager, cameraHandler); return true; } catch (CameraAccessException e) { Timber.w(e, "Could not execute single still capture request."); return false; } }
From source file:com.android.camera.one.v2.OneCameraZslImpl.java
/** * Request a single image./*from w w w. j a v a 2 s .c o m*/ * * @return true if successful, false if there was an error submitting the * capture request. */ private boolean sendSingleRequest(OneCamera.PhotoCaptureParameters params) { Log.v(TAG, "sendSingleRequest()"); try { CaptureRequest.Builder builder; builder = mDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE); builder.addTarget(mPreviewSurface); // Always add this surface for single image capture requests. builder.addTarget(mCaptureImageReader.getSurface()); builder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO); Flash flashMode = Flash.OFF; addFlashToCaptureRequestBuilder(builder, flashMode); addRegionsToCaptureRequestBuilder(builder); builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO); builder.set(CaptureRequest.CONTROL_AF_TRIGGER, CaptureRequest.CONTROL_AF_TRIGGER_IDLE); // Tag this as a special request which should be saved. builder.setTag(RequestTag.EXPLICIT_CAPTURE); if (sCaptureImageFormat == ImageFormat.JPEG) { builder.set(CaptureRequest.JPEG_QUALITY, (byte) (JPEG_QUALITY)); builder.set(CaptureRequest.JPEG_ORIENTATION, CameraUtil.getJpegRotation(params.orientation, mCharacteristics)); } mCaptureSession.capture(builder.build(), mCaptureManager, mCameraHandler); return true; } catch (CameraAccessException e) { Log.v(TAG, "Could not execute single still capture request.", e); return false; } }