addImageWatermarkUint8List method

  1. @override
Future<Uint8List?> addImageWatermarkUint8List(
  1. String filePath,
  2. Uint8List? bytes,
  3. Uint8List watermarkImagePath,
  4. int x,
  5. int y,
  6. int watermarkWidth,
  7. int watermarkHeight,
)
override

Adds an image watermark to the image at the specified location with the given parameters.

Returns a Uint8List representing the watermarked image.

Implementation

@override
Future<Uint8List?> addImageWatermarkUint8List(
  String filePath,
  Uint8List? bytes,
  Uint8List watermarkImagePath,
  int x,
  int y,
  int watermarkWidth,
  int watermarkHeight,
) async {
  final result = await watermarkImageChannel.invokeMethod<String?>(
    'addImageWatermark',
    {
      'filePath': filePath,
      'watermarkImagePath': watermarkImagePath,
      'x': x,
      'y': y,
      'watermarkWidth': watermarkWidth,
      'watermarkHeight': watermarkHeight,
      'quality': 100,
      'imageFormat': ImageFormat.png.name,
    },
  );
  if (result != null) {
    final resultBytes = await File(result).readAsBytes();
    return resultBytes;
  } else {
    return null;
  }
}