搜尋套件、儲存庫與 APP 分類

套件詳情v0.1.0

image_watermark

用於在影像上新增文字或圖片浮水的 Flutter 套件,您可自訂浮水的位置與顏色。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
900
喜歡數
64
Pub 分數
150

安裝套件

flutter pub add image_watermark

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,可實現將文字或影像水印加入圖像中,並支援自訂位置與顏色。它支援多種平台,包括 Android、iOS、Web、macOS、Windows 與 Linux。開發者可輕鬆將水印功能整合至其應用程式中,用於保護圖像或品牌宣傳。該套件提供簡單的 API 來定義水印內容、不透明度、對齊方式與偏移量,適用於靜態與動態水印需求。

適用情境

  • 向圖像添加版權資訊
  • 用標誌為照片添加品牌標示
  • 保護數位資產
  • 建立帶水印的預覽
  • 自定義水印外觀

主要特色

  • 支援文字和圖像水印
  • 可自定義的位置和對齊方式
  • 可調節的不透明度和顏色
  • 跨平台相容性
  • 簡單直覺的 API
  • 可設定的偏移量和填充值

適合對象

  • 影像編輯應用
  • 照片分享平台
  • 數位內容創作者
  • 電子商務應用
  • 需要圖像保護的應用程式

使用建議

  • 需要在加水印前載入影像
  • 效能可能會隨著大圖像而變化
  • 僅限基本水印樣式
  • 無內建預覽功能
  • 可能需要對複雜佈局進行額外處理

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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',
  );
final watermarkedImgBytes = 
    await ImageWatermark.addTextWatermark(
            imgBytes: imgBytes, ///image bytes
            watermarktext: 'watermarkText', ///watermark text
            color: Colors.white, ///default : Colors.black
          );

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
          );

Add image as watermark on image

final watermarkedImgBytes = 
    await ImageWatermark.addImageWatermark(
            originalImageBytes: imgBytes,
            waterkmarkImageBytes: watermarkImgByte,
          );
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
          );
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

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,
)

Screenshots

Screenshot

Screenshot

Screenshot

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。