compress method

Future<Uint8List?> compress({
  1. int? maxSize,
  2. ImageResolution? resolution,
  3. ImageFormat? format,
})

Compress image data.

  • maxSize - compressed file size limit (Bytes). (optional).
  • maxResolution - the maximum resolution compressed. (optional).
  • format - the image format you want to compress. (optional).

Implementation

Future<Uint8List?> compress(
    {int? maxSize, ImageResolution? resolution, ImageFormat? format}) async {
  final CompressParams _params = CompressParams(
      imageData: this,
      maxSize: maxSize,
      maxResolution: resolution,
      format: format);
  return IsolateFlutter.createAndStart(_compressImage, _params,
      debugLabel: 'isolate_image_compress');
}