List of usage examples for android.media CameraProfile getJpegEncodingQualityParameter
public static int getJpegEncodingQualityParameter(int quality)
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.jav a2 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; }