← Back to Skills Marketplace
tobewin

Watermark Pro

by ToBeWin · GitHub ↗ · v1.0.4 · MIT-0
cross-platform ✓ Security Clean
245
Downloads
0
Stars
0
Active Installs
5
Versions
Install in OpenClaw
/install watermark-pro
Description
文件水印工具。Use when user wants to add watermark to images, Word, PowerPoint, or PDF files. Supports text watermark, logo watermark, diagonal/center/tile layouts....
README (SKILL.md)

Watermark Pro

文件水印工具,支持图片、Word、PPT、PDF添加水印。

Features

  • 🖼️ 图片水印:支持JPG/PNG/WEBP
  • 📄 Word水印:支持.docx
  • 📊 PPT水印:支持.pptx
  • 📑 PDF水印:支持.pdf
  • ✍️ 文字水印:自定义文字、字体、颜色
  • 🖼️ Logo水印:支持透明PNG Logo
  • 📍 多种布局:对角线/居中/平铺

Trigger Conditions

  • "加水印" / "Add watermark"
  • "图片加水印" / "Word文档加水印"
  • "watermark-pro"

Step 1: Image Watermark

from PIL import Image, ImageDraw, ImageFont
import os

class ImageWatermark:
    def add_text_watermark(self, image_path, text, output_path,
                          font_size=None, color=(128, 128, 128),
                          opacity=0.3, angle=-45, layout='diagonal', density=200):
        img = Image.open(image_path).convert('RGBA')
        width, height = img.size
        watermark = Image.new('RGBA', img.size, (0, 0, 0, 0))
        draw = ImageDraw.Draw(watermark)
        
        if font_size is None:
            font_size = max(width, height) // 30
        
        try:
            font = ImageFont.truetype('/System/Library/Fonts/PingFang.ttc', font_size)
        except:
            font = ImageFont.load_default()
        
        alpha = int(255 * opacity)
        fill_color = (*color, alpha)
        
        if layout == 'diagonal':
            for y in range(0, height, density):
                for x in range(0, width, int(density * 1.4)):
                    draw.text((x, y), text, font=font, fill=fill_color)
        elif layout == 'center':
            bbox = draw.textbbox((0, 0), text, font=font)
            tw = bbox[2] - bbox[0]
            th = bbox[3] - bbox[1]
            draw.text(((width-tw)//2, (height-th)//2), text, font=font, fill=fill_color)
        
        watermark = watermark.rotate(angle, expand=False, resample=Image.BICUBIC)
        result = Image.alpha_composite(img, watermark)
        
        if output_path.lower().endswith('.jpg'):
            result = result.convert('RGB')
        result.save(output_path)
        return output_path

Step 2: Word Watermark

from docx import Document
from docx.shared import Pt, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH

class WordWatermark:
    def add_text_watermark(self, docx_path, text, output_path,
                          font_size=48, color=(200, 200, 200)):
        doc = Document(docx_path)
        
        for section in doc.sections:
            header = section.header
            header.is_linked_to_previous = False
            
            for para in header.paragraphs:
                para.clear()
            
            para = header.paragraphs[0] if header.paragraphs else header.add_paragraph()
            para.alignment = WD_ALIGN_PARAGRAPH.CENTER
            
            run = para.add_run(text)
            run.font.size = Pt(font_size)
            run.font.color.rgb = RGBColor(*color)
            run.font.name = '宋体'
            
            para.paragraph_format.space_before = Pt(250)
        
        doc.save(output_path)
        return output_path

Step 3: PowerPoint Watermark

from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN

class PptWatermark:
    def add_text_watermark(self, pptx_path, text, output_path,
                          font_size=60, color=(200, 200, 200)):
        prs = Presentation(pptx_path)
        
        for slide in prs.slides:
            txBox = slide.shapes.add_textbox(Inches(1.5), Inches(3), Inches(7), Inches(1.5))
            tf = txBox.text_frame
            p = tf.paragraphs[0]
            p.text = text
            p.font.size = Pt(font_size)
            p.font.color.rgb = RGBColor(*color)
            p.alignment = PP_ALIGN.CENTER
        
        prs.save(output_path)
        return output_path

Step 4: PDF Watermark (Image Overlay)

import fitz
from PIL import Image, ImageDraw, ImageFont
import os

class PdfWatermark:
    def add_text_watermark(self, pdf_path, text, output_path,
                          font_size=28, color=(128, 128, 128),
                          opacity=0.25, density=220):
        doc = fitz.open(pdf_path)
        
        for page in doc:
            rect = page.rect
            width, height = int(rect.width), int(rect.height)
            
            wm_img = Image.new('RGBA', (width, height), (0, 0, 0, 0))
            draw = ImageDraw.Draw(wm_img)
            
            try:
                font = ImageFont.truetype('/System/Library/Fonts/PingFang.ttc', font_size)
            except:
                font = ImageFont.load_default()
            
            alpha = int(255 * opacity)
            fill = (*color, alpha)
            
            for y in range(0, height, density):
                for x in range(0, width, int(density * 1.4)):
                    draw.text((x, y), text, font=font, fill=fill)
            
            temp_img = os.path.join(os.path.dirname(output_path), '_temp_wm.png')
            wm_img.save(temp_img)
            
            page.insert_image(rect, filename=temp_img, overlay=True)
        
        doc.save(output_path)
        doc.close()
        
        if os.path.exists(temp_img):
            os.remove(temp_img)
        
        return output_path

Usage Examples

User: "给图片加'版权所有'水印"
Agent: 使用 ImageWatermark.add_text_watermark()

User: "Word文档加'机密'水印"
Agent: 使用 WordWatermark.add_text_watermark()

User: "PDF加水印,密度高一点"
Agent: 使用 PdfWatermark.add_text_watermark(density=150)

Notes

  • 纯本地处理,无隐私风险
  • 支持中英文水印
  • 跨平台兼容
Usage Guidance
This skill is instruction-only and runs Python code locally to add watermarks. Before using: ensure you have python3 and are comfortable installing the listed Python packages (pip will download them from PyPI); only provide files you want processed; run in a sandbox if you have strict security requirements; review the pip package names yourself and, if desired, install dependencies in a virtual environment. There are no hidden network endpoints or credential requests in the SKILL.md, but installing dependencies does perform normal network downloads from PyPI.
Capability Analysis
Type: OpenClaw Skill Name: watermark-pro Version: 1.0.4 The skill bundle provides legitimate functionality for adding text watermarks to images, Word, PowerPoint, and PDF files using standard libraries (Pillow, python-docx, python-pptx, and PyMuPDF). The code in SKILL.md performs local file processing without any network requests, unauthorized file access, or suspicious execution patterns.
Capability Assessment
Purpose & Capability
Name/description (image/Word/PPT/PDF watermarking) match the provided Python code and declared dependency list (Pillow, python-docx, python-pptx, pymupdf). Requiring python3 is appropriate and proportional.
Instruction Scope
SKILL.md contains concrete Python implementations that operate on user-supplied files and write outputs locally. The instructions do not reference unrelated files, credentials, or external endpoints. They stay within the watermarking use case.
Install Mechanism
There is no formal install spec; SKILL.md lists a pip install line for common PyPI packages. That implies the agent (or user) will download packages from PyPI at runtime — expected for Python-based tooling but worth noting since it performs network downloads to install dependencies.
Credentials
No environment variables, credentials, or system config paths are requested. The code only reads/writes files supplied by the user and temporarily writes a local temp image for PDF processing — this is proportional to the documented functionality.
Persistence & Privilege
The skill is not always-enabled and does not request elevated or persistent system presence. It does not modify other skills or system-wide configuration.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install watermark-pro
  3. After installation, invoke the skill by name or use /watermark-pro
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.4
恢复完整代码示例,精简文字描述,确保功能完整
v1.0.3
精简SKILL.md:移除冗长代码示例,确保安全扫描完整
v1.0.2
改进PDF水印:使用图片叠加方式,效果更清晰,支持所有5种格式
v1.0.1
添加PDF水印支持:使用PyMuPDF,支持4种文档类型(图片/Word/PPT/PDF)
v1.0.0
文件水印工具:支持图片/Word/PPT添加文字或Logo水印,多种布局,纯本地处理
Metadata
Slug watermark-pro
Version 1.0.4
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 5
Frequently Asked Questions

What is Watermark Pro?

文件水印工具。Use when user wants to add watermark to images, Word, PowerPoint, or PDF files. Supports text watermark, logo watermark, diagonal/center/tile layouts.... It is an AI Agent Skill for Claude Code / OpenClaw, with 245 downloads so far.

How do I install Watermark Pro?

Run "/install watermark-pro" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Watermark Pro free?

Yes, Watermark Pro is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Watermark Pro support?

Watermark Pro is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Watermark Pro?

It is built and maintained by ToBeWin (@tobewin); the current version is v1.0.4.

💬 Comments