cropImage method

Future<CroppedFile?> cropImage({
  1. required String sourcePath,
  2. int? maxWidth,
  3. int? maxHeight,
  4. CropAspectRatio? aspectRatio,
  5. List<CropAspectRatioPreset> aspectRatioPresets = const [CropAspectRatioPreset.original, CropAspectRatioPreset.square, CropAspectRatioPreset.ratio3x2, CropAspectRatioPreset.ratio4x3, CropAspectRatioPreset.ratio16x9],
  6. CropStyle cropStyle = CropStyle.rectangle,
  7. ImageCompressFormat compressFormat = ImageCompressFormat.jpg,
  8. int compressQuality = 90,
  9. List<PlatformUiSettings>? uiSettings,
})

Crops the image located at sourcePath and returns the cropped image as a CroppedFile.

Implementation

Future<CroppedFile?> cropImage({
  required String sourcePath,
  int? maxWidth,
  int? maxHeight,
  CropAspectRatio? aspectRatio,
  List<CropAspectRatioPreset> aspectRatioPresets = const [
    CropAspectRatioPreset.original,
    CropAspectRatioPreset.square,
    CropAspectRatioPreset.ratio3x2,
    CropAspectRatioPreset.ratio4x3,
    CropAspectRatioPreset.ratio16x9
  ],
  CropStyle cropStyle = CropStyle.rectangle,
  ImageCompressFormat compressFormat = ImageCompressFormat.jpg,
  int compressQuality = 90,
  List<PlatformUiSettings>? uiSettings,
}) {
  return _platform.cropImage(
    sourcePath: sourcePath,
    maxWidth: maxWidth,
    maxHeight: maxHeight,
    aspectRatio: aspectRatio,
    aspectRatioPresets: aspectRatioPresets,
    cropStyle: cropStyle,
    compressFormat: compressFormat,
    compressQuality: compressQuality,
    uiSettings: uiSettings,
  );
}