image_watermark 0.1.0 copy "image_watermark: ^0.1.0" to clipboard
image_watermark: ^0.1.0 copied to clipboard

Flutter package to add text or image watermark on image,you can customize the position of watermark and color.

Image Watermark #

Languages #

Spanish

Image watermark is flutter pacakge to add text watermark and image watermark on image,you can customize the position of watermark and color.

Based on Image pacakge.

Check on pub.dev

Example code #

Add watermark text at center of image,parameter image bytes and string and it returns image bytes

final watermarkedImg = 
  await ImageWatermark.addTextWatermark(
    imgBytes: imgBytes,
    watermarktext: 'watermarkText',
  );
copied to clipboard
final watermarkedImgBytes = 
    await ImageWatermark.addTextWatermark(
            imgBytes: imgBytes, ///image bytes
            watermarktext: 'watermarkText', ///watermark text
            color: Colors.white, ///default : Colors.black
          );
copied to clipboard

Change the position of watermark

final watermarkedImg = 
    await ImageWatermark.addTextWatermark(
            imgBytes: imgBytes,             ///image bytes
            watermarktext: 'watermarkText',      ///watermark text
            dstX: 20,                   ///position of watermark x coordinate
            dstY: 30,                   ///y coordinate
            color: Colors.green, ///default : Colors.black
          );
copied to clipboard

Add image as watermark on image

final watermarkedImgBytes = 
    await ImageWatermark.addImageWatermark(
            originalImageBytes: imgBytes,
            waterkmarkImageBytes: watermarkImgByte,
          );
copied to clipboard
final watermarkedImgBytes = 
    await ImageWatermark.addImageWatermark(
            originalImageBytes: imgBytes,  //image bytes
            waterkmarkImageBytes: imgBytes2, //watermark img bytes
            imgHeight: 200,   //watermark img height
            imgWidth: 200,    //watermark img width
            dstY: 400, //watermark position Y
            dstX: 400, //watermark position X
          );
copied to clipboard

Add Fonts #

Image package only have arial Fonts, you can change the font converting a .ttf font in .fnt format:

  1. Download your font in .ttf format.

  2. Convert the font to .fnt format using the next site.

  3. Use ImageFont class, readOtherFontZip if you use .zip file; readOtherFont if you unzip and get the .fnt & .png files.

Example to change fonts

Add the font in pubspec.yaml:

  assets:
  - path/to/font.zip
copied to clipboard

Then use it as follows:

final assetFont = await rootBundle.load('path/to/font.zip');

final font = assetFont.buffer.asUint8List(assetFont.offsetInBytes, assetFont.lengthInBytes);

final bitMapFont = ImageFont.readOtherFontZip(font);

...

await ImageWatermark.addTextWatermark(
  imgBytes: imgBytes,
  font: bitMapFont, /// Font from .zip
  watermarkText: 'watermark text',
  dstX: 20,
  dstY: 40,
)
copied to clipboard

Screenshots #

Screenshot

Screenshot

Screenshot

62
likes
150
points
1.44k
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.22 - 2025.04.06

Flutter package to add text or image watermark on image,you can customize the position of watermark and color.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, image

More

Packages that depend on image_watermark