cutFaceFromImageBytes function

Future<Image> cutFaceFromImageBytes(
  1. Uint8List imgBytes,
  2. Rectangle rect
)

Cuts out the face from encoded image imgBytes

Implementation

Future<Image> cutFaceFromImageBytes(Uint8List imgBytes, Rectangle rect) async {
  final img2 = await cutFaceImageFromImageBytes(imgBytes, rect);

  imglib.PngEncoder pngEncoder = new imglib.PngEncoder(level: 0);
  List<int> png = pngEncoder.encode(img2);
  return Image.memory((png as Uint8List));
}