Android Bitmap to Byte Array Convert bitmapToByteArray(Bitmap bmp)

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

Description

bitmap To Byte Array

Declaration

public static byte[] bitmapToByteArray(Bitmap bmp) 

Method Source Code

//package com.java2s;
import java.io.ByteArrayOutputStream;

import android.graphics.Bitmap;

public class Main {
    public static byte[] bitmapToByteArray(Bitmap bmp) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bmp.compress(Bitmap.CompressFormat.JPEG, 60, stream);
        byte[] byteArray = stream.toByteArray();

        return byteArray;
    }//w  w  w . jav a2 s .  c o m
}

Related

  1. Bitmap2Bytes(Bitmap bm)
  2. bitmap2Bytes(Bitmap bm)
  3. bitmapToBytes(Bitmap bm)
  4. bmpToByteArray(final Bitmap bmp, final boolean needRecycle)
  5. convertBitmapToByte(Bitmap bitmap)
  6. getBitmapData(Bitmap bmp)