Friday 15 February 2013

android - Losing a lot of quality on image crop -


I am capturing an image with the camera and then saving it to an SQL database.

After this I allow the user to harvest it. The quality of the whole process is very low after the quality is very poor.

I'm testing it on Nexus7 and I know its front camera is bad, but right after the crop app opens, the picture is very small, it looks like crean of 1/5 in the crop activity. And I do not know why.

What is this onActivityResult (captured photo)

  @Actride Public zero special result (int Requestcode, Inc as result code, intent data) {if (requestCode == CAMERA_REQUEST & resultcode == activity. RESULT_OK} {bitmap bitmap = (bitmap) Data.getExtras (). Receive ("data"); String Path = Picture. Media. GetActivity () GetContentResolver (), bitmap, "title", empty); Uri Uti URI = Uri. Pars (Path); If (DoCrop (imageUri)) saveNewAvatar (bitmap); }}   

And here doCrop (Uri Yuri) is the method:

  Private zeros cancellation Do (last Uri image Yuri) {intent = intention ("com.android.camera.action.CROP"); Intent.setType ("image / *"); & Lt; ResolveInfo & gt; List = getActivity () GetPackageManager (). QueryIntentActivities (Intent, 0); Int size = list.size (); Intent.setData (imageUri); Intent.putExtra ("aspectX", 1); Intent.putExtra ("aspectY", 1); Intent.putExtra ("scale", true); Intent.putExtra ("return-data", true); If (size == 1) {intent i = new intent (intent); ResolveInfo Res = list.get (0); I.setComponent (new component name (res.activityInfo.packageName, res.activityInfo.name)); StartActivityForResult (i, CROP);  

Edit: did some research and followed the code

Finished with: < / Div>

is very wrong (like: probably works, but it is not that you do such things on Android ) talk about your code, but the source of the problem is that you read the image with the data key in Extras, in addition the version is just a small one, and it is very short Quality Is there.

You have to change the way you use the camera. It is a bit intuitive, but you do not get the URL taken from the camera, but on the contrary: pass a URL in the camera and try it Will do and will keep a picture there.

The URL can point to the SD card or you can manually ContentProvider .

No comments:

Post a Comment