简体   繁体   中英

How to crop an attached image in android?

I want to crop an image from attachment before displaying it in my activity.. im really struggled in this...

Here is mycode for cropping an image:

Intent bigimgintent = new Intent("com.android.camera.CropImage"); 

bigimgintent.setClassName("com.android.gallery", "com.android.camera.CropImage"); 
bigimgintent.putExtra("crop", "true"); 
bigimgintent.putExtra("scale",false); 
bigimgintent.putExtra("return-data", return_data);
bigimgintent.putExtra("outputX",  1024); 
bigimgintent.putExtra("outputY", 768); 
bigimgintent.putExtra(MediaStore.EXTRA_OUTPUT,uri);
bigimgintent.putExtra("outputFormat",Bitmap.CompressFormat.JPEG.toString());

if (circleCrop) { 
    bigimgintent.putExtra("circleCrop", true); 
}

startActivityForResult(bigimgintent,1);
 bigimgintent.putExtra("crop", "true"); 
bigimgintent.putExtra("outputX", 300);
bigimgintent.putExtra("outputY", 300);
bigimgintent.putExtra("aspectX", 1);
bigimgintent.putExtra("aspectY", 1);
bigimgintent.putExtra("scale",true); // make this as true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM