I am currently using an intent to take a picture, like this:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
intent.putExtra("return-data", true);
startActivityForResult(intent, CAMERA_REQUEST);
But I really need to set the image size as close to a square as possible. So after researching it seems you need to do something like this:
Camera camera = Camera.open();
Parameters params = camera.getParameters();
List<Camera.Size> sizes = params.getSupportedPictureSizes();
// Once you will see the supported Sizes, you can define them with the method :
setPictureSize(int width, int height);
My questions are, do these work together or is it an either/or? Which method works best for my needs?
Again, I have 96px by 96px box for user profile pics. After user takes the picture I want the image to fill entire box without stretching. Is the best way to set size at the point of picture being taken, or alter the imageView
or bitmap
(or ...?) after the fact? OR, should I just let the users crop the picture and I can define the cropping area dimensions?
Edit: See bounty for updated question.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…