Need a solution to upload highquality/original image to server from android app









up vote
-1
down vote

favorite












Method to capture image:



public void captureImage() 
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent,1800);



onActivityResult:



@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1800)

flag=requestCode;
photo= (Bitmap) data.getExtras().get("data");



Here's how i convert my bitmap to Base64 for upload



ByteArrayOutputStream stream=new ByteArrayOutputStream(); 
photo.compress(Bitmap.CompressFormat.PNG,100,stream);
byte byte_arr = stream.toByteArray();
String encodeString= Base64.encodeToString(byte_arr,0);
uploadImage(encodeString);


I've tried both JPEG and PNG compression and checked the server
the image was resized to 182x252 pixels
If there's any library to upload the image to server, that'll help me too.



Thank you in advance.










share|improve this question























  • Why don't you use multipart and Retrofit?
    – Ümañg ßürmån
    20 hours ago










  • I've not used them till now, let me research.
    – AruN
    20 hours ago










  • Sure. You can find it on their website
    – Ümañg ßürmån
    20 hours ago










  • Did you think to check the size of the image you're sending? That is, did you check the size of photo in onActivityResult()?
    – Mike M.
    20 hours ago










  • Damn man, you are correct, the bitmap is of low resolution
    – AruN
    19 hours ago














up vote
-1
down vote

favorite












Method to capture image:



public void captureImage() 
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent,1800);



onActivityResult:



@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1800)

flag=requestCode;
photo= (Bitmap) data.getExtras().get("data");



Here's how i convert my bitmap to Base64 for upload



ByteArrayOutputStream stream=new ByteArrayOutputStream(); 
photo.compress(Bitmap.CompressFormat.PNG,100,stream);
byte byte_arr = stream.toByteArray();
String encodeString= Base64.encodeToString(byte_arr,0);
uploadImage(encodeString);


I've tried both JPEG and PNG compression and checked the server
the image was resized to 182x252 pixels
If there's any library to upload the image to server, that'll help me too.



Thank you in advance.










share|improve this question























  • Why don't you use multipart and Retrofit?
    – Ümañg ßürmån
    20 hours ago










  • I've not used them till now, let me research.
    – AruN
    20 hours ago










  • Sure. You can find it on their website
    – Ümañg ßürmån
    20 hours ago










  • Did you think to check the size of the image you're sending? That is, did you check the size of photo in onActivityResult()?
    – Mike M.
    20 hours ago










  • Damn man, you are correct, the bitmap is of low resolution
    – AruN
    19 hours ago












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











Method to capture image:



public void captureImage() 
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent,1800);



onActivityResult:



@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1800)

flag=requestCode;
photo= (Bitmap) data.getExtras().get("data");



Here's how i convert my bitmap to Base64 for upload



ByteArrayOutputStream stream=new ByteArrayOutputStream(); 
photo.compress(Bitmap.CompressFormat.PNG,100,stream);
byte byte_arr = stream.toByteArray();
String encodeString= Base64.encodeToString(byte_arr,0);
uploadImage(encodeString);


I've tried both JPEG and PNG compression and checked the server
the image was resized to 182x252 pixels
If there's any library to upload the image to server, that'll help me too.



Thank you in advance.










share|improve this question















Method to capture image:



public void captureImage() 
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent,1800);



onActivityResult:



@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1800)

flag=requestCode;
photo= (Bitmap) data.getExtras().get("data");



Here's how i convert my bitmap to Base64 for upload



ByteArrayOutputStream stream=new ByteArrayOutputStream(); 
photo.compress(Bitmap.CompressFormat.PNG,100,stream);
byte byte_arr = stream.toByteArray();
String encodeString= Base64.encodeToString(byte_arr,0);
uploadImage(encodeString);


I've tried both JPEG and PNG compression and checked the server
the image was resized to 182x252 pixels
If there's any library to upload the image to server, that'll help me too.



Thank you in advance.







android arrays image bitmap base64






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 20 hours ago









Ümañg ßürmån

2,5782727




2,5782727










asked 20 hours ago









AruN

41




41











  • Why don't you use multipart and Retrofit?
    – Ümañg ßürmån
    20 hours ago










  • I've not used them till now, let me research.
    – AruN
    20 hours ago










  • Sure. You can find it on their website
    – Ümañg ßürmån
    20 hours ago










  • Did you think to check the size of the image you're sending? That is, did you check the size of photo in onActivityResult()?
    – Mike M.
    20 hours ago










  • Damn man, you are correct, the bitmap is of low resolution
    – AruN
    19 hours ago
















  • Why don't you use multipart and Retrofit?
    – Ümañg ßürmån
    20 hours ago










  • I've not used them till now, let me research.
    – AruN
    20 hours ago










  • Sure. You can find it on their website
    – Ümañg ßürmån
    20 hours ago










  • Did you think to check the size of the image you're sending? That is, did you check the size of photo in onActivityResult()?
    – Mike M.
    20 hours ago










  • Damn man, you are correct, the bitmap is of low resolution
    – AruN
    19 hours ago















Why don't you use multipart and Retrofit?
– Ümañg ßürmån
20 hours ago




Why don't you use multipart and Retrofit?
– Ümañg ßürmån
20 hours ago












I've not used them till now, let me research.
– AruN
20 hours ago




I've not used them till now, let me research.
– AruN
20 hours ago












Sure. You can find it on their website
– Ümañg ßürmån
20 hours ago




Sure. You can find it on their website
– Ümañg ßürmån
20 hours ago












Did you think to check the size of the image you're sending? That is, did you check the size of photo in onActivityResult()?
– Mike M.
20 hours ago




Did you think to check the size of the image you're sending? That is, did you check the size of photo in onActivityResult()?
– Mike M.
20 hours ago












Damn man, you are correct, the bitmap is of low resolution
– AruN
19 hours ago




Damn man, you are correct, the bitmap is of low resolution
– AruN
19 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237333%2fneed-a-solution-to-upload-highquality-original-image-to-server-from-android-app%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237333%2fneed-a-solution-to-upload-highquality-original-image-to-server-from-android-app%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線