问题
I am cropping an image in circular fashion and using below code while creating the intent
intent.setData(mImageCaptureUri);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
Since I am using outputX = 200, I am getting width and height of every cropped image as 200 and 200 , no matter how much I zoom-in or zoom out.
Below shown both images have different zoom ratio but still return same height and width.
width = bitmap.getWidth();


Can someone please tell me what parameter should I use in line
intent.putExtra("outputX", 200);
so that I get the TRUE width and height(not the 200 in each case) of cropped image.
回答1:
Didn't know this was the issue when I answered the your earlier question. I believe the answer you are looking for should be:
intent.setData(mImageCaptureUri);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", false);
Make sure you set the parameter scale to false. It defaults to true.
PS Since Android is open source and the camera + crop app is a part of the OS, all I am doing is reading the source. The file you should be looking at is here. Check out variable mScale to see how the parameter is being used.
来源:https://stackoverflow.com/questions/19699496/cropped-image-size-in-android-is-constant