crop static method

Future<Uint8List> crop({
  1. required Uint8List bytes,
  2. required Rect cropRectNormalized,
  3. int rotation = 0,
  4. bool flipHorizontal = false,
  5. bool flipVertical = false,
  6. CropShape shape = CropShape.rectangle,
  7. OutputFormat format = OutputFormat.preserve,
  8. int quality = 90,
})

Crops, rotates, flips, and masks an image represented as raw bytes.

bytes is the raw image file data (JPEG, PNG, WebP, etc.). cropRectNormalized is the cropping rectangle normalized between 0.0 and 1.0 relative to the displayed/transformed image bounds. rotation is the rotation angle in degrees (0, 90, 180, 270). flipHorizontal whether to mirror horizontally. flipVertical whether to mirror vertically. shape rectangle or circle mask. format output encoding format. quality encoding quality (1-100).

Implementation

static Future<Uint8List> crop({
  required Uint8List bytes,
  required Rect cropRectNormalized,
  int rotation = 0,
  bool flipHorizontal = false,
  bool flipVertical = false,
  CropShape shape = CropShape.rectangle,
  OutputFormat format = OutputFormat.preserve,
  int quality = 90,
}) async {
  return compute(
    _cropTask,
    _CropTaskParams(
      bytes: bytes,
      cropRectNormalized: cropRectNormalized,
      rotation: rotation,
      flipHorizontal: flipHorizontal,
      flipVertical: flipVertical,
      shape: shape,
      format: format,
      quality: quality,
    ),
  );
}