I'm loading a picture from my phone then I'm encoding it using base64 encoding just like this :
Bitmap bm = BitmapFactory.decodeFile(selectedImagePath);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object
byte[] b = baos.toByteArray();
encodedImage = Base64.encodeToString(b, Base64.DEFAULT);
As I was wondering about this string I'm getting, I displayed it like this :
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
final AlertDialog builder = new AlertDialog.Builder(DataActivity.this).create();
builder.setTitle("Title");
builder.setMessage(encodedImage);
builder.show();
}
},2500);
I'm getting a decent string with all the letters and numbers with + and / and ==. So it's "working". However when I use a website to encode it, I'm getting a totally different string. Here is a part of the beginning of the string on my phone : http://img11.hostingpics.net/pics/136937Screenshot20150212023946.png and the website where I encoded my picture : http://www.base64-image.de/step-2.php. The beginning of the string is (according to the website) :
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT
Am I missing something? . Thank you