Code example for YuvImage

Methods: compressToJpeg

    	Log.i("FD", "Sart processFrame()");
        face = DetectFaces(data, max_num_faces);
//        Log.i("FD", "faces" + face); 
     // Convert to JPG 
        //Size previewSize = camera.getParameters().getPreviewSize();  
        YuvImage yuvimage=new YuvImage(data, ImageFormat.NV21, getFrameWidth(), getFrameHeight(), null);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        yuvimage.compressToJpeg(new Rect(0, 0, getFrameWidth(), getFrameHeight()), 100, baos);
        byte[] jdata = baos.toByteArray();
        // Convert to Bitmap 
        bmp = BitmapFactory.decodeByteArray(jdata, 0, jdata.length);
        return bmp;
Connect your IDE to all the code out there  Get Codota for Java