如何获得jpeg 100的质量? Camera2API

时间:2016-07-04 14:30:59

标签: java android image camera android-camera

如果您使用Camera2API,我花了很多时间来询问如何设置jpeg质量,最后找到这样的解决方案

我通过将其作为CaptureRequest.Builder的键添加来提高JPEG质量

JPEG质量在Camer2BasicFragment的captureStillPicture()方法中设置,如下所示:

// This is the CaptureRequest.Builder that we use to take a picture.
    final CaptureRequest.Builder captureBuilder =
            mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
    captureBuilder.addTarget(mImageReader.getSurface());

    //Set the JPEG quality here like so
    captureBuilder.set(CaptureRequest.JPEG_QUALITY, (byte)100);

感谢@BlinkingCahill

但问题就是如果我在保存的图片中设置质量100,我会96 ...

也许有人知道我如何获得100?或者它取决于设备还是其他?

0 个答案:

没有答案