after using the below code for coping the image, the quality is really bad, so i'm asking if is there any solution to do something like instagram's croping utility, of if is there any coping library we can use here is my code :
Intent intent = new Intent();
// call android default gallery
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
// ******** code for crop image
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 4);
intent.putExtra("aspectY", 4);
intent.putExtra("outputX", 800);
intent.putExtra("outputY", 800);
intent.putExtra("scale", true);
intent.putExtra("scaleUpIfNeeded", true);
intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
try {
intent.putExtra("return-data", true);
startActivityForResult(Intent.createChooser(intent,
"Complete action using"), PICK_FROM_GALLERY);
} catch (ActivityNotFoundException e) {
// Do nothing for now
}
return true;
case android.R.id.home:
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_FROM_GALLERY) {
Bundle extras2 = data.getExtras();
if (extras2 != null)
{
Bitmap photo = extras2.getParcelable("data");
attachimage.setImageBitmap(photo);
Bitmap photo = extras2.getParcelable("data");
}
Here is the looking picture after coping :