Android examples for android.graphics:JPEG
Down-samples a jpeg byte array
import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { /**/*from ww w. ja va2 s . c om*/ * Down-samples a jpeg byte array. * * @param data * a byte array of jpeg data * @param downSampleFactor * down-sample factor * @return decoded and down-sampled bitmap */ public static Bitmap downSample(final byte[] data, int downSampleFactor) { final BitmapFactory.Options opts = new BitmapFactory.Options(); // Downsample the image opts.inSampleSize = downSampleFactor; return BitmapFactory.decodeByteArray(data, 0, data.length, opts); } }