Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.util.Base64; import java.io.ByteArrayOutputStream; public class Main { public static String bitmapToBase64(Bitmap bitmap) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, bytes); byte[] byteArr = bytes.toByteArray(); return Base64.encodeToString(byteArr, Base64.DEFAULT); } }