Java tutorial
//package com.java2s; //License from project: Creative Commons License import java.io.ByteArrayOutputStream; import java.io.IOException; import android.graphics.Bitmap; import android.util.Base64; public class Main { public static String convertToBase64(Bitmap bmp) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, 80, stream); byte[] byteArray = stream.toByteArray(); try { stream.close(); } catch (IOException e) { e.printStackTrace(); } return Base64.encodeToString(byteArray, Base64.DEFAULT); } }