Example usage for android.graphics Bitmap compress

List of usage examples for android.graphics Bitmap compress

Introduction

In this page you can find the example usage for android.graphics Bitmap compress.

Prototype

@WorkerThread
public boolean compress(CompressFormat format, int quality, OutputStream stream) 

Source Link

Document

Write a compressed version of the bitmap to the specified outputstream.

Usage

From source file:Main.java

public static boolean m6975a(Bitmap bitmap, OutputStream outputStream) {
    return bitmap.compress(CompressFormat.JPEG, 90, outputStream);
}

From source file:Main.java

public static boolean saveAsPNG(Bitmap bitmap, String fileName) throws FileNotFoundException {
    return bitmap.compress(Bitmap.CompressFormat.PNG, 1, new FileOutputStream(fileName));
}

From source file:Main.java

public static byte[] bitmapToByteArray(Bitmap b) {
    ByteArrayOutputStream bs = new ByteArrayOutputStream();
    b.compress(Bitmap.CompressFormat.PNG, 50, bs);
    return bs.toByteArray();
}

From source file:Main.java

public static byte[] bitmapToByteArray(Bitmap b) {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    b.compress(Bitmap.CompressFormat.PNG, 100, bos);
    return bos.toByteArray();
}

From source file:Main.java

public static byte[] Bitmap2Bytes(Bitmap bm) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
    return baos.toByteArray();
}

From source file:Main.java

public static byte[] BitmapToBytes(Bitmap bm) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
    return baos.toByteArray();
}

From source file:Main.java

public static byte[] convertBitmap2Bytes(Bitmap bm) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
    return baos.toByteArray();
}

From source file:Main.java

public static byte[] bitmap2Bytes(Bitmap bm) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
    return baos.toByteArray();
}

From source file:Main.java

public static byte[] Bitmap2Bytes(Bitmap bm) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
    return baos.toByteArray();
}

From source file:Main.java

/**
 * convert Bitmap to byte array//  w  w w .  j a  v  a2  s. c  o  m
 */
public static byte[] bitmapToByte(Bitmap b) {
    ByteArrayOutputStream o = new ByteArrayOutputStream();
    b.compress(Bitmap.CompressFormat.PNG, 100, o);
    return o.toByteArray();
}