I'm sending images from Android to the server in C # but when I try to do the conversion it makes an error in this conversion.
In android I make this conversion:
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmapPhoto.compress(Bitmap.CompressFormat.JPEG, 50, stream);
final byte[] img_byte = stream.toByteArray();
final String imageString = Base64.encodeToString(img_byte, Base64.DEFAULT);
On the c # server I get the string and re-convert to image:
byte[] novaFoto = Convert.FromBase64String(NovaFoto.FotoString);
using (MemoryStream stream = new MemoryStream(novaFoto))
{
Image image = Image.FromStream(stream);
}
Sometimes it makes an error converting to byte [] and sometimes gives error in Image.FromStream
Can anyone help me with this?