AIM: To crop the Image in android.
Solution:
The main thing is open gallery with the intent to Crop the image.
as
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", aspectX);
intent.putExtra("aspectY", aspectY);
intent.putExtra("outputX", outputX);
intent.putExtra("outputY", outputY);
intent.putExtra("scale", scale);
intent.putExtra("return-data", return_data);
intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
intent.putExtra("noFaceDetection",!faceDetection); // lol, negative boolean noFaceDetection
if (circleCrop) {
intent.putExtra("circleCrop", true);
}
startActivityForResult(intent, PHOTO_PICKED);
You can download the entire project here by clicking DOWNLOAD PHOTO CROP CODE.
If any problems let me know.
Thanks for the snippets ,
ReplyDeleteThis code is not working on Motorola Atrix(android-2.3.6) .Is there any external parameter that i need to pass ??
is there any way, that allow us to open specific image for cropping, rather than selecting from gallery
ReplyDeletei am looking for the same thing, you are asking here.
Deletepleae reply me on coolhtarksheel@gmail.com, if you have found any way...???
How to pass bitmap to another activity? Need help. Please
ReplyDelete