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.
android arrays image bitmap base64
|
show 1 more comment
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.
android arrays image bitmap base64
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 ofphoto
inonActivityResult()
?
– Mike M.
20 hours ago
Damn man, you are correct, the bitmap is of low resolution
– AruN
19 hours ago
|
show 1 more comment
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.
android arrays image bitmap base64
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
android arrays image bitmap base64
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 ofphoto
inonActivityResult()
?
– Mike M.
20 hours ago
Damn man, you are correct, the bitmap is of low resolution
– AruN
19 hours ago
|
show 1 more comment
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 ofphoto
inonActivityResult()
?
– 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
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
inonActivityResult()
?– Mike M.
20 hours ago
Damn man, you are correct, the bitmap is of low resolution
– AruN
19 hours ago