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 { private static final Bitmap.CompressFormat FORMAT = Bitmap.CompressFormat.PNG; private static final int QUALITY = 100; private static final int BASE64_FLAGS = Base64.DEFAULT; public static String serialize(Bitmap poster) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); poster.compress(FORMAT, QUALITY, byteArrayOutputStream); return Base64.encodeToString(byteArrayOutputStream.toByteArray(), BASE64_FLAGS); } }