android - Increase image quality using Base64 string or other techniques -


i'm playing image uploading on android , first method encountered using base64 codification, noticed image quality drastically lowered.

do have suggestion or know other ways upload image mongodb keeping quality?


code i'm using:

public static string tobase64(bitmap image) {     bytearrayoutputstream stream = new bytearrayoutputstream();     image.compress(bitmap.compressformat.jpeg, 100, stream);     return base64.encodetostring(stream.tobytearray(), base64.no_wrap); }  public static bitmap frombase64(string encodedimage) {     byte[] decodedstring = base64.decode(encodedimage, base64.default);     return bitmapfactory.decodebytearray(decodedstring, 0, decodedstring.length); } 

and here's use capture image:

private void captureimage() {     intent cameraintent = new intent(android.provider.mediastore.action_image_capture);     startactivityforresult(cameraintent, camera_request); }  @override public void onactivityresult(int requestcode, int resultcode, intent data) {     if (requestcode == camera_request && resultcode == activity.result_ok) {         bitmap image = (bitmap) data.getextras().get("data");         uploadimage(image);     } } 


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -