compressImageBytes method

  1. @override
Future<ImageBytesResult> compressImageBytes(
  1. Uint8List source,
  2. ImageCompressConfig config
)
override

Compress bytes in memory. Images only — a video would mean copying tens of megabytes across the platform channel in one message.

Implementation

@override
Future<ImageBytesResult> compressImageBytes(
  Uint8List source,
  ImageCompressConfig config,
) async {
  try {
    return await FfmpegImage.compressBytes(source: source, config: config);
  } on CompressException {
    rethrow;
  } catch (e) {
    throw ImageCompressException(CompressErrorCode.imageCompressFailed, '$e');
  }
}