Make sure you convert back to bitmap at the End, ie Server side
1, convert your imageview to bitmap.
imageView.buildDrawingCache(); Bitmap bmap = imageView.getDrawingCache();
2, convert bitmap to base64 String and pass to server
public String getEncoded64ImageStringFromBitmap(Bitmap bitmap) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.JPEG, 70, stream); byte[] byteFormat = stream.toByteArray(); // get the base 64 string String imgString = Base64.encodeToString(byteFormat, Base64.NO_WRAP); return imgString; }
3, At server side convert base64 to bitmap. (this is java code, do it in your server side language)
byte[] decodedString = Base64.decode(Base64String.getBytes(), Base64.DEFAULT); Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
set this bitmap to display image