Android Bitmap to Byte Array Convert bitmapTobyte(Bitmap bmp)

Here you can find the source of bitmapTobyte(Bitmap bmp)

Description

bitmap Tobyte

Declaration

public static byte[] bitmapTobyte(Bitmap bmp) 

Method Source Code

//package com.java2s;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;

import java.io.ByteArrayOutputStream;

public class Main {

    public static byte[] bitmapTobyte(Bitmap bmp) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bmp.compress(CompressFormat.PNG, 100, baos);
        return baos.toByteArray();
    }/* w ww.  ja  va 2s .c o m*/
}

Related

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