Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.util.Base64; import java.io.ByteArrayOutputStream; public class Main { /** * generate base64 from bitmap image * @param mBitmap bitmap image * @return base64 string */ public static String ImageToBase64(Bitmap mBitmap) { ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos1); byte[] b1 = baos1.toByteArray(); return Base64.encodeToString(b1, Base64.DEFAULT); } }