addWaterToImage static method

dynamic addWaterToImage(
  1. dynamic imageToAddWatermark,
  2. dynamic finalImageFile,
  3. dynamic waterMarkText,
  4. GetxController controller,
)

Implementation

static addWaterToImage(var imageToAddWatermark,finalImageFile,waterMarkText,GetxController controller)async{
   var pickedImage=File(imageToAddWatermark.path);
   var decodedImage = await decodeImageFromList(await pickedImage.readAsBytes());
   var height = decodedImage.height;  // Image height
   var width = decodedImage.width;
   var _watermarkPlugin = WatermarkUnique();


   final imageWithWaterMark = await _watermarkPlugin.addTextWatermark(
       filePath: imageToAddWatermark.path, // image file path
       text: '$waterMarkText', // watermark text
       x: 100, // position by x
       y: height-400, // position by y
       textSize: 90, // text size
       quality: 25,

       color: Colors.white, // color of text
       //backgroundTextColor: Colors.black, // color of background text (optional)
       backgroundTextPaddingLeft: 12, // padding of background text (optional)
       backgroundTextPaddingTop: 12, // padding of background text (optional)
       backgroundTextPaddingRight: 12, // padding of background text (optional)
       backgroundTextPaddingBottom: 12,
       imageFormat: ImageFormat.jpeg

   );
   finalImageFile=File(imageWithWaterMark!);
   controller.update();
}