private static String encodeToBase64( Bitmap image, Bitmap.CompressFormat compressFormat, int quality) { ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream(); image.compress(compressFormat, quality, byteArrayOS); return Base64.encodeToString(byteArrayOS.toByteArray(), Base64.DEFAULT); }
// Convert image to base64 for server sending. public String getImageBase64() { return Base64.encodeToString(photoByteArray, 0); }