In my android application , i want to convert image into bytes and encode it. and send to database. But when i convert it back on image, it do not show. Please help.and tell me where i am making mistake
final Bitmap image=(images.get(position));
int size = image.getRowBytes() * image.getHeight();
ByteBuffer buffer = ByteBuffer.allocate(size); //Create a new buffer
image.copyPixelsToBuffer(buffer); //Move the byte data to the buffer
byte[] array = buffer.array();
encodedImageString = Base64.encodeToString(array, Base64.DEFAULT);
Now on the server side when i decode this encoded imageString and write it, it do not display image.
Byte[] imageByteArary= base64.decode(encodedImageString);
File myfile=new File("D://test1.jpg");
myfile.createNewFile();
FileOutputStream fOut=new FileOutputStream (myfile);
fOut.write(imageByteArray);
fOut.close();