crop method

  1. @override
FutureOr<String?> crop(
  1. Uint8List imageData,
  2. int x,
  3. int y,
  4. int width,
  5. int height,
)
override

Implementation

@override
FutureOr<String?> crop(Uint8List imageData, int x, int y, int width, int height)
{
  // get decoder
  final decoder = findDecoderForData(imageData);
  if (decoder == null) return null;

  // decode image
  Image? image = decoder.decode(imageData);
  if (image != null)
  {
    image = copyCrop(image,x: x,y: y, width: width, height: height);
    return _encode(image, decoder);
  }
  return null;
}