Crop a picture
Public void Cropphoto (Uri uri) {
if (uri = =null) {
return;
}
Intent Intent = New Intent ("Com.android.camera.action.CROP"); //action-cropping
Intent.setdataandtype (URI, "image/*"); //Type
Intent.putextra (Mediastore. Extra_output, Uri.fromfile (imagetempfile)); //
Output file
Intent.putextra ("OutputFormat", Bitmap.compressformat. JPEG. toString ());
Output format
Intent.putextra ("crop",true);
Intent.putextra ("Aspectx", 1); //cropping ratio
Intent.putextra ("Aspecty", 1); //cropping ratio
Intent.putextra ("Outputx", 2048); //Output size
Intent.putextra ("Outputy", 2048); //cropping scale after output scale
Intent.putextra ("scale",true); //Zoom
Intent.putextra ("scaleupifneeded",true); //If the output size is less than required, enlarge
Intent.putextra ("Return-data",false); //Do not return thumbnails
Intent.putextra ("Nofacedetection",true); //Turn off face recognition
Startactivityforresult (Intent, CROP);
}
More lazy, write put here spare ~ ~
Android call system to crop picture settings