Last Updated: February 25, 2016
· d-32

Android photo chooser with crop

Launch the photo chooser like this:

Intent intent = new Intent(Intent.ACTION_PICK, 

intent.putExtra("crop", "true");
intent.putExtra("scale", true);
intent.putExtra("outputX", PHOTO_WIDTH);
intent.putExtra("outputY", PHOTO_HEIGHT);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("return-data", true);
startActivityForResult(intent, 1);

PHOTOWIDTH and PHOTOHEIGHT is the width and height the output photo will have. Android will do all the resizing for you.
You can also set the aspect-ratio, in this example it's 1:1.

After the photo has been chosen and cropped the user will return to your application:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != RESULT_OK) {

    if (requestCode == 1) {
        final Bundle extras = data.getExtras();

        if (extras != null) {
            Bitmap photo = extras.getParcelable("data");

And now you have your photo as Bitmap :)