uCrop
uCrop copied to clipboard
circular crop option
Hi , I m also looking for circular crop, i have upgrdaed ucrop to 2.26 and image_cropper library to latest , still circular crop is not happening . It is cropping as square only even after executing var options = UCrop.Options(); options.setCircleDimmedLayer(true)
Below is the code i have used , please suggest if i had missed any. Thanks File cropped = await ImageCropper.cropImage( sourcePath: _photoUrlFile.path, compressQuality: 99, cropStyle: CropStyle.circle, compressFormat: ImageCompressFormat.png, // aspectRatioPresets: [CropAspectRatioPreset.square], // maxWidth: 1200, // maxHeight: 1400, androidUiSettings: AndroidUiSettings( toolbarColor: Colors.orange, toolbarWidgetColor: Colors.white, lockAspectRatio: false, toolbarTitle: 'Crop It'), );
any update?
hi ! you can use the uCrop Option like this :
Uri destinationUri = Uri.fromFile(new File(getCacheDir(), "cropped.jpg"));
UCrop.Options options = new UCrop.Options();
UCrop uCrop = UCrop.of(sourceUri, destinationUri);
options.setCompressionQuality(80);
// UI theme
options.setToolbarTitle("Crop Photo Profile");
options.setMaxScaleMultiplier(5);
options.setImageToCropBoundsAnimDuration(666);
options.setDimmedLayerColor(Color.CYAN);
options.setCircleDimmedLayer(true);
options.setShowCropFrame(false);
options.setCropGridStrokeWidth(20);
options.setCropGridColor(Color.GREEN);
options.setCropGridColumnCount(2);
options.setCropGridRowCount(1);
options.withAspectRatio(16, 9);
options.withMaxResultSize(1000, 1000);
// Color palette
options.setToolbarColor(ContextCompat.getColor(this, R.color.white));
options.setStatusBarColor(ContextCompat.getColor(this, R.color.black));
options.setToolbarWidgetColor(ContextCompat.getColor(this, R.color.color1));
options.setRootViewBackgroundColor(ContextCompat.getColor(this, R.color.color8));
options.setActiveControlsWidgetColor(ContextCompat.getColor(this, R.color.color6));
uCrop.withOptions(options);
uCrop.start(this);