我需要将图像裁剪成方形。我使用那个功能:
private void crop(Uri imageUri) {
File photoGallery = new File(Environment.getExternalStorageDirectory(), "temp_image.jpg");
checkImageSize(photoGallery);
Intent cropIntentGallery = new Intent("com.android.camera.action.CROP");
cropIntentGallery.setDataAndType(imageUri, "image/*");
cropIntentGallery.putExtra("crop", true);
cropIntentGallery.putExtra("aspectX", 1);
cropIntentGallery.putExtra("aspectY", 1);
cropIntentGallery.putExtra("outputX", PHOTO_SIZE);
cropIntentGallery.putExtra("outputY", PHOTO_SIZE);
cropIntentGallery.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoGallery));
startActivityForResult(cropIntentGallery, REQ_EDIT_CAMERA);
}
它会打开裁剪活动,但我可以更改X和Y尺寸。 我需要的是修复最小尺寸,因此如果图像是以横向模式制作的 - 用户将能够剪切左边缘和/或右边缘(如果是纵向 - 顶部或/和底部边缘)。 是否有一些额外的参数可以做到这一点?
顺便说一句,在哪里我可以找到所有可能的意图附加列表? (如:“aspectX”,“outputX”......)