Here you can find the source of bitmap2Base64(Bitmap bitmap, int bitmapQuality)
public static String bitmap2Base64(Bitmap bitmap, int bitmapQuality)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import android.graphics.Bitmap; import android.util.Base64; public class Main { public static String bitmap2Base64(Bitmap bitmap, int bitmapQuality) { String string = null;//from www. j av a 2s. c o m byte[] bytes = bitmapToBytes(bitmap); string = Base64.encodeToString(bytes, Base64.DEFAULT); return string; } public static byte[] bitmapToBytes(Bitmap bm) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); return baos.toByteArray(); } }