encode method

  1. @override
Future<Uint8List> encode(
  1. Uint8List bytes,
  2. int width,
  3. int height, {
  4. required int quality,
  5. String? mime,
})
override

Encode(or compress) image data to given format/inputs

bytes image data to save width width of save image height height of save image mime MIME type of the save image quality quality of the save image, maximum is 100, size of saved image will be directly proportional to the quality

return byte array of encoded image if successful otherwise exception will be thrown

Implementation

@override
Future<Uint8List> encode(
  Uint8List bytes,
  int width,
  int height, {
  required int quality,
  String? mime,
}) =>
    _invokeMethod<Uint8List>(method: Functions.encode, arguments: {
      Arguments.data: bytes,
      Arguments.width: width,
      Arguments.height: height,
      Arguments.mime: mime,
      Arguments.quality: quality,
    });