Android Bitmap to Byte Array Convert Bitmap2Bytes(Bitmap bm)

Here you can find the source of Bitmap2Bytes(Bitmap bm)

Description

Bitmap Bytes

Declaration

public static byte[] Bitmap2Bytes(Bitmap bm) 

Method Source Code

//package com.java2s;
import java.io.ByteArrayOutputStream;
import android.graphics.Bitmap;

public class Main {

    public static byte[] Bitmap2Bytes(Bitmap bm) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
        return baos.toByteArray();
    }/*from w w  w . ja  v  a 2  s. c om*/
}

Related

  1. bitmapToBytes(Bitmap bm)
  2. bmpToByteArray(final Bitmap bmp, final boolean needRecycle)
  3. convertBitmapToByte(Bitmap bitmap)
  4. getBitmapData(Bitmap bmp)
  5. bitmapTobyte(Bitmap bmp)
  6. bitmap2Bytes(Bitmap bitmap, Bitmap.CompressFormat mCompressFormat, final boolean needRecycle)
  7. bitmap2Bytes(Bitmap bm, Bitmap.CompressFormat format)
  8. bmpToByteArray(final Bitmap bmp, final boolean needRecycle)
  9. convertBitmapToByteArray(Bitmap bitmap)