系统自带 com.android.camera.action.CROP

选择图片

拍照
1
2
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE
startActivityForResult(intent,1);
相册选择
1
2
3
4
5
6
7
8
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent,2);
```
#### 获取图像URI
重写*onActivityResult*方法
#####camera
```java

#####photo

1
Uri uri = data.getData();

图片栽剪

1
2
3
4
5
6
7
8
9
10
11
12
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
// 设置裁剪.
intent.putExtra("crop", "true");
// aspectX aspectY 是宽高的比例.
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
// outputX outputY 是裁剪图片宽高.
intent.putExtra("outputX", 340);
intent.putExtra("outputY", 340);
intent.putExtra("return-data", true);
startActivityForResult(intent, 500);