|
Get and cut a picture
Intent Intent = new Intent (intent.action_get_content);
Intent.settype ("image/*");
Intent.putextra ("Crop", "true"); Open cut
Intent.putextra ("Aspectx", 1); The width-to-height ratio of the cut is 1:2
Intent.putextra ("Aspecty", 2);
Intent.putextra ("Outputx", 20); Save picture width and height
Intent.putextra ("Outputy", 40);
Intent.putextra ("Output", Uri.fromfile (New File ("/mnt/sdcard/temp")); Save path
Intent.putextra ("OutputFormat", "JPEG");//return format
Startactivityforresult (Intent, 0);
Cut a specific picture
Intent Intent = new Intent ("Com.android.camera.action.CROP");
Intent.setclassname ("Com.android.camera", "com.android.camera.CropImage");
Intent.setdata (Uri.fromfile ("New File") ("/mnt/sdcard/temp"));
Intent.putextra ("Outputx", 1); The width-to-height ratio of the cut is 1:2
Intent.putextra ("Outputy", 2);
Intent.putextra ("Aspectx", 20); Save picture width and height
Intent.putextra ("Aspecty", 40);
Intent.putextra ("scale", true);
Intent.putextra ("Nofacedetection", true);
Intent.putextra ("Output", Uri.parse ("file:///mnt/sdcard/temp"));
Startactivityforresult (Intent, 0);
|