Install
openclaw skills install p提供图片加载、尺寸调整、裁剪、格式转换、增强、滤镜、拼接、背景移除和文字添加等多功能创意图片处理能力。
openclaw skills install pname: p-skill version: 1.0.0 description: 创意图片处理技能包,以"P一下图片"为核心理念,提供图片基础操作、增强、滤镜、拼接、背景移除、文字添加等强大功能
强大的图片处理工具包,让你轻松 "P一下图片"!p 字母代表 Power(强力)、Productivity(生产力)、Precision(精准)、Playful(有趣)。
pip install -r requirements.txt
from p_skill import (
load_image, save_image,
resize_image, crop_image,
smart_enhance,
grayscale, sepia,
stitch_horizontal,
remove_background_simple,
add_text
)
# 加载图片
image = load_image("input.jpg")
# 调整尺寸
resized = resize_image(image, scale=0.5)
# 智能增强
enhanced = smart_enhance(resized)
# 添加复古滤镜
filtered = sepia(enhanced)
# 添加文字
with_text = add_text(filtered, "Hello p-skill!", position="bottom-center")
# 保存结果
save_image(with_text, "output.jpg")
加载图片文件。
参数:
file_path: 图片文件路径返回: PIL Image 对象
保存图片到文件。
参数:
image: PIL Image 对象output_path: 输出文件路径quality: 图片质量 (1-100),默认 95调整图片尺寸。
参数:
image: PIL Image 对象size: 目标尺寸 (width, height)scale: 缩放比例返回: 调整后的图片
裁剪图片。
参数:
image: PIL Image 对象box: 裁剪区域 (left, upper, right, lower)返回: 裁剪后的图片
转换图片格式。
参数:
image: PIL Image 对象format: 目标格式 ('JPEG', 'PNG', 'WEBP' 等)返回: 格式转换后的图片
调整图片亮度。
参数:
image: PIL Image 对象factor: 亮度因子 (1.0 为原图,<1.0 变暗,>1.0 变亮)调整图片对比度。
参数:
image: PIL Image 对象factor: 对比度因子 (1.0 为原图)调整图片清晰度。
参数:
image: PIL Image 对象factor: 清晰度因子 (1.0 为原图,>1.0 更锐利)智能增强,一键优化图片。
黑白滤镜。
复古滤镜。
模糊滤镜。
参数:
radius: 模糊半径,默认 2轮廓滤镜。
反色滤镜。
像素化滤镜。
参数:
pixel_size: 像素块大小,默认 10水平拼接多张图片。
参数:
images: 图片列表align: 对齐方式 ('top', 'bottom', 'center')垂直拼接多张图片。
参数:
images: 图片列表align: 对齐方式 ('left', 'right', 'center')网格拼接多张图片。
参数:
images: 图片列表cols: 列数rows: 行数(可选,自动计算)align: 对齐方式简单背景移除(适用于白色/浅色背景)。
参数:
threshold: 颜色阈值 (0-255),默认 240smooth_radius: 边缘平滑半径,默认 2返回: 透明背景的 RGBA 图片
指定颜色背景移除。
参数:
target_color: 目标背景颜色 (R, G, B)tolerance: 颜色容差,默认 30smooth_radius: 边缘平滑半径,默认 2返回: 透明背景的 RGBA 图片
向图片添加文字。
参数:
image: PIL Image 对象text: 要添加的文字内容position: 位置 ('top-left', 'top-center', 'top-right', 'center-left', 'center', 'center-right', 'bottom-left', 'bottom-center', 'bottom-right') 或 (x, y) 坐标font_size: 字体大小,默认 36color: 文字颜色 (R, G, B) 或 (R, G, B, A)font_path: 字体文件路径(可选,使用系统默认)rotation: 旋转角度,默认 0offset: 相对于位置的偏移 (x, y),默认 (0, 0)返回: 添加文字后的图片