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 .  j a  v a  2  s .  c o m
}

Related

  1. bitmap2Bytes(Bitmap bm)
  2. bitmapToByteArray(Bitmap bmp)
  3. bitmapToBytes(Bitmap bm)
  4. bmpToByteArray(final Bitmap bmp, final boolean needRecycle)