2

I know how to craete a circular bitmap it was shown in following examples

Crop square image to circle - Programmatically

Cropping circular area from bitmap in Android

In the above examples how to fit the image into circular view,, I searched a lot and what i found large is ,,,,, In most of code they have been using the following function to crop the image

 private void performCrop() 
 {
  // take care of exceptions
  try {
   // call the standard crop action intent (the user device may not
   // support it)
   Intent cropIntent = new Intent("com.android.camera.action.CROP");
   // indicate image type and Uri
   cropIntent.setDataAndType(picUri, "image/*");
   // set crop properties
   cropIntent.putExtra("crop", "true");
   // indicate aspect of desired crop
   cropIntent.putExtra("aspectX", 1);
   cropIntent.putExtra("aspectY", 1);
   // indicate output X and Y
   cropIntent.putExtra("outputX", 256);
   cropIntent.putExtra("outputY", 256);
   // retrieve data on return
   cropIntent.putExtra("return-data", true);
   // start the activity - we handle returning in onActivityResult
   startActivityForResult(cropIntent, PIC_CROP);
  }
  // respond to users whose devices do not support the crop action
  catch (ActivityNotFoundException anfe) {
   // display an error message
   String errorMessage = "Whoops - your device doesn't support the crop action!";
   Toast toast = Toast
     .makeText(this, errorMessage, Toast.LENGTH_SHORT);
   toast.show();
  }
 }

Actually rectangular cropping is achieved via the above mentioned code ,,,I want to use the above function for circular cropping,,,Please provide your help,,,

Community
  • 1
  • 1

1 Answers1

2

You can check out the Similar link Cirular Crop

Try out as below for circular crop:

Exta Options Table for image/* crop:

 SetExtra   DataType   Description     

   crop     String  Signals the crop feature
  aspectX   int Aspect Ratio
  aspectY   int Aspect Ratio
  outputX   int width of output created from this Intent
  outputY   int width of output created from this Intent
  scale     boolean     should it scale
  return-data   boolean Return the bitmap with Action=inline-data by using the data
  data  Parcelable  Bitmap to process, you may provide it a bitmap (not tested)
  circleCrop    String  if this string is not null, it will provide some circular cr
  MediaStore.EXTRA_OUTPUT ("output")    URI Set this URi to a File:///, see example code
 try {
// Launch picker to choose photo for selected contact
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);
} catch (ActivityNotFoundException e) {
Toast.makeText(thiz, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
}

I found it from HERE

Community
  • 1
  • 1
GrIsHu
  • 29,068
  • 10
  • 64
  • 102
  • the answers u have provided is just the problems what i have mentioned above sir,the examples finally deliver circular image but not provide circular crop inside cropping fuction,sorry –  Sep 30 '13 at 06:49