Created
November 27, 2014 08:37
-
-
Save lenamuit/9cf40a8599bca9fcef23 to your computer and use it in GitHub Desktop.
Create image picker: resize and scale output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Intent galleryIntent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); | |
| galleryIntent.setType("image/*"); | |
| galleryIntent.putExtra("crop", "true"); | |
| galleryIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri()); | |
| galleryIntent.putExtra("aspectX", 1); | |
| galleryIntent.putExtra("aspectY", 1); | |
| galleryIntent.putExtra("outputX", 512); | |
| galleryIntent.putExtra("outputY", 512); | |
| galleryIntent.putExtra("scaleUpIfNeeded", true); | |
| galleryIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); | |
| galleryIntent.putExtra("return-data", false); | |
| //Create chooser | |
| Intent chooser = Intent.createChooser(galleryIntent,"Select images"); | |
| startActivityForResult(chooser, PICK_PHOTO); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment