Skip to content

Instantly share code, notes, and snippets.

@finleyChen
Created April 10, 2013 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finleyChen/5355634 to your computer and use it in GitHub Desktop.
Save finleyChen/5355634 to your computer and use it in GitHub Desktop.
private void cropImage() {
// Use existing crop activity.
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(mImageCaptureUri, IMAGE_UNSPECIFIED);
// Specify image size
intent.putExtra("outputX", 100);
intent.putExtra("outputY", 100);
// Specify aspect ratio, 1:1
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
// REQUEST_CODE_CROP_PHOTO is an integer tag you defined to
// identify the activity in onActivityResult() when it returns
startActivityForResult(intent, REQUEST_CODE_CROP_PHOTO);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment