compress Image By Ratio - Android Media

Android examples for Media:Picture

Description

compress Image By Ratio

Demo Code


//package com.java2s;

import java.io.ByteArrayOutputStream;

import android.graphics.Bitmap;

public class Main {
    public static ByteArrayOutputStream compressImageByRatio(Bitmap image,
            int ratio) {

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        image.compress(Bitmap.CompressFormat.JPEG, ratio, baos); 

        return baos;
    }//w  w  w  .  j  ava 2  s .  c o  m
}

Related Tutorials