2

I will try to be brief as much as I can , I am developing an app for a company atm where I am required to have the following feature:

Click on an image-->Pop a Dialog-->Pick (Take new image , Choose existing Image)-->After picking or taking the image-->Crop the Image with 1:1 Aspect ration so it becomes a square.

I have successfully implemented the feature a while ago but then I realized that the image quality decreases dramatically, After some research (6 hours) I realized that if You do not pass a directory to save the image for the crop intent , it returns a "Thumbnail" which is pretty much useless in my case and here comes the list of questions I have :

1- I can not specify where the directory to save the image is (I want to save it to the gallery and if possible create a new folder with my app name and save it into it)

2- I managed to get the cropped image with good quality but of course it is large in size so when I encode it to Base64 string and send it to the server it takes lots of time , would love to know which approach is better (Compress it by 10% , and then re-size it or Re-size it only or compress it only)

3- Is there some sort of tutorial handling such sequence I could read ??

4- I realized that since I am saving the image from the Open Camera Intent and then from the Crop intent it gets saved twice , how can I delete one of them ??

1 Answer 1

1
  1. That you get thumbnail, when the destination location is not explicitly specified, is fine, the full image is still written to disk. See Android Camera : data intent returns null. Look at the "official" code sample on developer.android.com for the best practice. Note that there may still be glitches on some devices/ROMs, see capturing images with MediaStore.ACTION_IMAGE_CAPTURE intent in android. Actually, when you use an Intent, it may finally get fulfilled by a 3rd party Camera app installed by the end-user, and their behavior may be arbitrary.

  2. Resize is not equivalent to Compress. Please be more specific about your primary concern. I don't know why you should base64 your image to upload it, but the rule of thumb would be to scale the cropped result down to the dimensions expected on the server side, and after that tweak the Jpeg compression factor to achieve the expected file size.

  3. You may start with Wikipedia.

  4. If your app has the appropriate permissions, you can. See Deleting a gallery image after camera intent photo taken.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.