Android examples for Graphics:Bitmap Effect
save Yuv Bitmap To JPG
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import android.graphics.Rect; import android.graphics.YuvImage; public class Main { public static void saveYuvToJpeg_newApi(File jpegFile, byte[] yuv420sp, int width, int height, int format, int quality) { try {// www . java 2s . c o m if (!jpegFile.exists()) jpegFile.createNewFile(); YuvImage image = new YuvImage(yuv420sp, format, width, height, null); FileOutputStream fos = new FileOutputStream(jpegFile); image.compressToJpeg( new Rect(0, 0, image.getWidth(), image.getHeight()), quality, fos); fos.flush(); fos.close(); } catch (IOException e) { e.printStackTrace(); } } }