我使用下面的代码从intent中裁剪图像,输出图像大小应为640px。我的问题是我必须将裁剪框限制或禁用为640,并且它不应该可以调整大小。
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");
intent.setData(mImageCaptureUri);
intent.putExtra("outputX", 640);
intent.putExtra("outputY", 640);
intent.putExtra("aspectX", 640);
intent.putExtra("aspectY", 640);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
答案 0 :(得分:-1)
public void imageGalleryCapture(){
Intent intent = new Intent();
// call android default gallery
intent.setType("image/*");
intent.setAction(Intent.ACTION_PICK);
// code for crop image
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
intent.putExtra("outputX", 640);
intent.putExtra("outputY", 640);
try {
intent.putExtra("return-data", true);
startActivityForResult(Intent.createChooser(intent,
"Complete action using"), PICK_FROM_GALLERY);
} catch (ActivityNotFoundException e) {
// Do nothing for now
}
}