List of usage examples for java.io ByteArrayOutputStream toByteArray
public synchronized byte[] toByteArray()
From source file:Main.java
public static Bitmap codec(Bitmap src, Bitmap.CompressFormat format, int quality) { ByteArrayOutputStream os = new ByteArrayOutputStream(); src.compress(format, quality, os);/* w ww . ja v a2s .co m*/ byte[] array = os.toByteArray(); return BitmapFactory.decodeByteArray(array, 0, array.length); }
From source file:Main.java
/** * convert Bitmap to byte array/*ww w . ja v a 2s. c o m*/ */ public static byte[] bitmapToByte(Bitmap b) { ByteArrayOutputStream o = new ByteArrayOutputStream(); b.compress(Bitmap.CompressFormat.PNG, 100, o); return o.toByteArray(); }
From source file:Main.java
/** * Decodes a bitmap to its corresponding representation in bytes, in the format sent as parameter * * @param bitmap Bitmap to decode/* ww w. j ava 2 s .c o m*/ * @param format Format with which this image is going to be decoded * @return A byte array containing the bytes of the decoded bitmap */ public static byte[] bitmapToByteArray(Bitmap bitmap, Bitmap.CompressFormat format) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(format, 100, stream); return stream.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[] getBytes(Bitmap bitmap) { ByteArrayOutputStream baops = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0, baops); return baops.toByteArray(); }
From source file:Main.java
private static Bitmap compassBitmap(Bitmap src, Bitmap.CompressFormat format, int quality) { ByteArrayOutputStream os = new ByteArrayOutputStream(); src.compress(format, quality, os);/*from www. j a v a2s.c o m*/ byte[] array = os.toByteArray(); return BitmapFactory.decodeByteArray(array, 0, array.length); }
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[] getBytes(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0, stream); return stream.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(); }