Example usage for android.media CameraProfile QUALITY_HIGH

List of usage examples for android.media CameraProfile QUALITY_HIGH

Introduction

In this page you can find the example usage for android.media CameraProfile QUALITY_HIGH.

Prototype

int QUALITY_HIGH

To view the source code for android.media CameraProfile QUALITY_HIGH.

Click Source Link

Usage

From source file:com.android.camera.manager.ThumbnailViewManager.java

private byte[] covertYuvDataToJpeg(byte[] data, int yuvWidth, int yuvHeight, int imageFormat) {
    byte[] jpeg;/*from w  ww  . j  ava 2 s  .c o m*/
    Rect rect = new Rect(0, 0, yuvWidth, yuvHeight);
    // TODO: the yuv data from native must be NV21 or YUY2.
    YuvImage yuvImg = new YuvImage(data, imageFormat, yuvWidth, yuvHeight, null);
    ByteArrayOutputStream outputstream = new ByteArrayOutputStream();
    int jpegQuality = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_HIGH);
    yuvImg.compressToJpeg(rect, jpegQuality, outputstream);
    jpeg = outputstream.toByteArray();
    return jpeg;
}