watermark_unique
watermark_unique 是一个 Flutter 包,用于在图像上添加文本和图像水印。您可以自定义水印的位置、颜色、背景色和内边距。
用于向图像添加水印的 Flutter 包
以下为英文项目原文快照,最新内容请访问 GitHub。
watermark_unique is a flutter package to add text and image watermarks on an image. You can customize the watermark's position, color, background color, and padding. Check on pub.dev: https://pub.dev/packages/watermark_unique
Parameters for image that you can change
An example of how you can add text to an image (only IOS or Android):
final image = await watermarkPlugin.addTextWatermark(
filePath: photo!.path, // image file path
text: 'Test watermark text', // watermark text
x: 500, // position by x
y: 400, // position by y
textSize: 250, // text size
color: Colors.purpleAccent, // color of text
isNeedRotateToPortrait: true, // rotation image to portrait (Default: false) ONLY ANDROID
backgroundTextColor: Colors.black.withOpacity(0.5), // color of background text (optional)
quality: 100, // quality of image with watermark
backgroundTextPaddingLeft: 12, // padding of background text (optional)
backgroundTextPaddingTop: 12, // padding of background text (optional)
backgroundTextPaddingRight: 12, // padding of background text (optional)
backgroundTextPaddingBottom: 12, // padding of background text (optional)
imageFormat: ImageFormat.jpeg, // image format that you will use to compress
);
An example of how you can add a watermark to an image (only IOS or Android):
final image = await watermarkPlugin.addImageWatermark(
filePath: photo!.path, // image file path
watermarkImagePath: watermark!.path, // watermark image file path
x: 500, // position by x
y: 400, // position by x
quality: 100, // quality of image with watermark
imageFormat: ImageFormat.jpeg, // image format that you will use to compress
watermarkWidth: 300, // watermark image width
watermarkHeight: 300, // watermark image height
);
An example of how you can add text to an image and get results via Uint8List (IOS || Android || WEB):
final image = await watermarkPlugin.addTextWatermarkUint8List(
filePath: photo!.path, // image file path
text: 'Test watermark text', // watermark text
x: 500, // position by x
y: 400, // position by y
textSize: 250, // text size
color: Colors.purpleAccent, // color of text
isNeedRotateToPortrait: true, // rotation image to portrait (Default: false) ONLY ANDROID
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, // padding of background text (optional)
);
An example of how you can add a watermark to an image and get results via Uint8List (IOS || Android || WEB):
final image = await watermarkPlugin.addImageWatermarkUint8List(
filePath: photo!.path, // image file path
watermarkImagePath: watermark!.path, // watermark image file path
x: 500, // position by x
y: 400, // position by x
watermarkWidth: 300, // watermark image width
watermarkHeight: 300, // watermark image height
);

依赖清单 6 项
{"sdk":"flutter"}{"sdk":"flutter"}^2.1.8^4.5.4{"sdk":"flutter"}^5.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗