Bitmap Bytes - Android Graphics

Android examples for Graphics:Bitmap Byte Array

Description

Bitmap Bytes

Demo Code


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

public class Main {
    static public 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 a2 s  . co m
}

Related Tutorials