← 返回 Skills 市场
siconvip

Image Assets Resize — 图片素材尺寸延展

作者 OrangeMoon · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
47
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install image-assets-resize
功能描述
直接以参考KV/海报/拍脸图为输入,调用 gpt-image-2 或 Nano Banana 模型,按目标规格批量生成精确尺寸的图片文件,交付前AI自检文字裁切、元素完整性等问题。支持自定义规范学习、产品设计语言积累。
使用说明 (SKILL.md)

Image Assets Resize — 图片物料尺寸延展

直接以参考KV/海报/拍脸图为输入,调用 gpt-image-2 或 Nano Banana 模型原图延展, 按目标规格批量生成精确尺寸的图片文件,交付前AI自检文字裁切、元素完整性等问题。

核心思路

把参考图直接传给图像模型的 edit 模式,用一句中文描述目标尺寸即可。模型原生理解图片内容,无需先分析再描述,也无需中间裁切。

快速开始

# 0. 首次使用:初始化配置(选择模型、设置API密钥)
python scripts/generate_image.py --setup

# 1. 根据参考图生成单平台配图
python scripts/generate_image.py \
  -i 参考KV.png \
  -p wechat-cover \
  -s "五一福利活动"

# 2. 多平台批量生成
python scripts/generate_image.py \
  -i 参考KV.png \
  -p wechat-cover,xiaohongshu-cover,douyin-cover \
  -s "618大促"

# 3. 高质量 + AI自检
python scripts/generate_image.py \
  -i 参考KV.png \
  -p wechat-cover,weibo-horizontal \
  -s "双11活动" \
  -q high \
  --verify

# 4. 需要添加文字/图标时使用 --extra-prompt
python scripts/generate_image.py \
  -i 参考KV.png \
  -p douyin-cover \
  -s "五一活动" \
  --extra-prompt "在顶部添加文字'五一狂欢',底部加一个红色按钮"

# 5. 需要纯净版(去除原图LOGO/文案)
python scripts/generate_image.py \
  -i 参考KV.png \
  -p douyin-cover \
  -s "王者荣耀" \
  --extra-prompt "不要带logo"

# 6. 查看所有平台
python scripts/generate_image.py --list-platforms

# 7. 查看平台规格详情
python scripts/generate_image.py --get-spec wechat-cover

# 8. 自定义平台规格(临时使用,自动学习)
python scripts/generate_image.py \
  -i 参考KV.png \
  -p "我的海报:1200x800" \
  -s "五一活动"
# 首次使用后自动保存为 custom_我的海报_1200x800,下次可直接用 -p custom_我的海报_1200x800

# 9. 永久添加自定义平台规格
python scripts/generate_image.py --add-spec "我的海报" 1200 800

# 10. 列出所有自定义规格
python scripts/generate_image.py --list-custom

支持的模型

模型 配置名称 说明
GPT Image 2 gpt-image-2 OpenAI 官方图像生成模型,速度快,质量稳定
Nano Banana 2 nano-banana-2 Google Gemini 3.1 Flash Image,性价比高,中文渲染好
Nano Banana Pro nano-banana-pro Google Gemini 3 Pro Image,专业级画质

通过 --setup 选择模型,或直接编辑 ~/.content-marketing/config.json

完整流程

首次使用: --setup 选择模型 → 配置API地址/密钥
  ↓
输入参考图 (-i)
  ↓
[1] 查询平台规格 → 确定目标尺寸
  ↓
[2] 计算合法生成尺寸 → 16 的倍数且 ≥ 1MP
  ↓
[3] 一句话 prompt 调用 backend(gpt-image-2 / nano-banana)
     → "以这张参考图为基准,适配生成一张【平台名】,尺寸WxH..."
  ↓
[4] 微缩放至精确尺寸(通常 ≤ 1%,无视觉损失)
  ↓
[5](可选)AI 自检验证
  ↓
[6] 规范命名保存 + 记录品牌学习数据

命令行参数

参数 简写 说明 必填
--image-path -i 参考KV/海报路径(直接作为 edit 输入) 推荐
--brand -b 品牌名称(默认 "default")
--platforms -p 目标平台Key,逗号分隔
--scene -s 活动/场景名称
--quality -q low/medium/high(默认 medium)
--output-dir -o 输出目录(默认 output/)
--version 版本号(默认 1)
--verify 生成后执行 AI 自检验证
--extra-prompt 额外指令。添加元素:"顶部加'五一狂欢'文字";去除元素(纯净版):"不要带logo"
--dry-run 预览 prompt 不生成图片
--setup 初始化配置向导(选择模型、设置API)
--show-config 显示当前配置
--add-spec 添加自定义平台规格,如 --add-spec "我的平台" 1200 800
--remove-spec 删除自定义平台规格,如 --remove-spec custom_我的平台_1200x800
--list-custom 列出所有自定义规格
--base64 云端模式:结果 JSON 中包含 base64 编码图片,供 OpenClaw 直接展示给用户

输出规范

output/{场景}_{平台名称}_{宽}x{高}_v{版本}.png

示例:

output/五一福利活动_微信公众号封面_900x383_v1.png
output/五一福利活动_抖音视频封面_1080x1920_v1.png
output/618大促_小红书笔记封面_1242x1660_v1.png

尺寸处理逻辑

图像模型要求宽高为 16 的倍数且总像素数不低于约 1MP。工具自动处理:

  1. 以目标尺寸为基准,等比例放大到满足最低像素预算
  2. 对齐到最近的 16 倍数
  3. 生成后微缩放至精确目标尺寸(缩放因子通常 ≥ 0.94,无视觉损失)

例如:目标 900×383 → 生成尺寸 1536×656 → 缩放至 900×383(比例差 \x3C 1%)

Prompt 模式

模式 触发条件 行为
完整版(默认) 不加 --extra-prompt 保留原图所有视觉元素(角色/文字/图标/装饰),仅调整构图
纯净版 --extra-prompt "不要带logo" 仅保留角色和背景,去除文字/LOGO/装饰
添加元素 --extra-prompt "加文字..." 在保留原图基础上按指令添加新元素

AI 自检(可选)

添加 --verify 参数启用 GPT-4o 质量检查,检测文字裁切、元素完整性等问题。

自学习与反馈

每次生成后可通过 feedback 记录评分和意见,系统会累积品牌设计语言。

python scripts/generate_image.py --feedback "品牌名" 0 5 "配色准确,继续保持"

支持的平台规格

场景 尺寸 比例
微信公众号封面 900×383 900:383
公众号方形缩略图 300×300 1:1
朋友圈竖版海报 1080×1920 9:16
朋友圈方版海报 1080×1080 1:1
小红书封面 1242×1660 3:4
小红书方版 1080×1080 1:1
抖音封面 1080×1920 9:16
微博横版 1200×675 16:9
微博方版 1200×1200 1:1
微博竖版 1200×1500 4:5
视频号封面 1080×1080 1:1
B站封面 1146×717 16:10
知乎封面 1080×1080 1:1
淘宝主图 800×800 1:1
快手封面 1080×1920 9:16
Facebook 方版贴文 1200×1200 1:1
Facebook 横版贴文 1200×630 40:21
Facebook 封面照片 1200×628 300:157
Facebook 快拍 1080×1920 9:16
Instagram 方版贴文 1200×1200 1:1
Instagram 竖版贴文 630×1200 21:40
Instagram 快拍 1080×1920 9:16
X (Twitter) 方版贴文 1200×1200 1:1
X (Twitter) 横版贴文 1200×900 4:3
X (Twitter) 封面横幅 1500×500 3:1
X (Twitter) 信息流图片 1600×900 16:9
Pinterest 图钉 1000×1500 2:3
Pinterest 方版图钉 1000×1000 1:1
Pinterest Idea Pin 1080×1920 9:16
LinkedIn 横版贴文 1200×627 1200:627
LinkedIn 方版贴文 1080×1080 1:1
LinkedIn 公司封面 1128×191 1128:191

完整规格含安全区说明见 references/platform-specs.md

云端 OpenClaw 部署

当这个 skill 部署在云端 OpenClaw 时,用户通过会话交互:

用户 ──(上传参考图 + 文字需求)──→ OpenClaw Agent
                                      │
                         保存上传图片到临时目录
                                      │
                         调用 python generate_image.py \
                           -i \x3C临时路径> -p wechat-cover -s "五一" --base64
                                      │
                         脚本输出 JSON(含 base64 图片)
                                      │
                         Agent 解析 JSON,将会话中的图片展示给用户
                                      │
用户 ←──(收到适配后的图片)──── OpenClaw Agent

输入流程

  1. 用户在会话中直接上传原始图片素材
  2. OpenClaw Agent 收到上传文件,保存到服务器临时目录
  3. Agent 调用 generate_image.py,将临时路径传入 --image-path
  4. 如果 OpenClaw 不支持文件上传,需要将图片先转存到可访问的 URL,或通过其他方式传入

输出流程

  1. 脚本生成图片后保存到本地,同时输出 ## Result JSON
  2. 普通模式(不加 --base64):JSON 只包含路径,需要 Agent 自行读取文件返回给用户
  3. 云端模式--base64):JSON 中每个成功结果包含 image_base64 字段,Agent 可直接用 data:image/png;base64,... 在会话中展示
  4. 建议云端调用始终加 --base64 参数

示例输出(--base64 模式)

{
  "tool": "image-assets-resize",
  "success": true,
  "total": 2,
  "ok": 2,
  "results": [
    {
      "platform": "wechat-cover",
      "output_path": "output/五一_微信公众号封面_900x383_v1.png",
      "success": true,
      "image_base64": "iVBORw0KGgo..."
    }
  ],
  "output_dir": "output",
  "scene": "五一"
}

配置文件位置:~/.content-marketing/config.json

{
  "backend": "gpt-image-2",
  "base_url": "https://api.openai.com/v1",
  "api_key_env": "OPENAI_API_KEY"
}
字段 说明
backend gpt-image-2 / nano-banana-2 / nano-banana-pro
base_url API 地址(可配置中转网关)
api_key_env 环境变量名(推荐,避免密钥明文存储)
api_key 密钥明文(不推荐,仅当无法使用环境变量时)

通过 --setup 交互式配置,或直接编辑 JSON 文件。

自定义平台规格

三种方式新增自定义规格:

1. 内联格式(即用即学)

-p "我的平台:宽x高"

首次使用自动保存,下次可直接用 key 调用。

2. 永久添加

--add-spec "平台名称" 宽度 高度

保存后永久可用,--list-custom 查看所有自定义规格。

3. 删除

--remove-spec custom_key

自定义规格存储在 ~/.content-marketing/custom_specs.json,可与他人共享复制。

安全使用建议
This skill is internally consistent with its stated purpose, but review and consider the following before installing or running it: - API keys: the tool needs API keys (OPENAI_API_KEY and GPT_IMAGE2_API_KEY). These keys permit the skill to send images and prompts to external model endpoints. Provide least-privileged keys and avoid using keys tied to sensitive accounts. - Data sent externally: input images (encoded as base64) and generated prompts are transmitted to external model endpoints for editing/generation and optional AI verification. Do not use the skill with images containing sensitive personal data or proprietary content you cannot share. - Local persistence: config, saved specs, and generation history are stored under ~/.content-marketing; generated images are saved to the chosen output directory. If you care about local data retention, inspect or clear that directory. - Optional downloads/execution: the upscaler can download and run a Real-ESRGAN binary from GitHub if you explicitly request installation. That download is from a public GitHub release (not a random URL) but the code currently references a Windows zip which may be an oversight—review before installing and run installs only on machines you control. - Base64 cloud mode: the --base64 option packages images into JSON for platform display; enabling it will put raw image data into the tool's outputs which may be transmitted to the OpenClaw UI/backend—avoid with sensitive images. If these behaviors are acceptable for your use case (you intend to send images to an external image model and to keep local records), the skill appears safe to use. If you are unsure, test in a restricted environment and inspect ~/.content-marketing after first runs.
功能分析
Type: OpenClaw Skill Name: image-assets-resize Version: 1.0.0 The skill bundle exhibits high-risk behaviors, most notably in `scripts/upscaler.py`, which automatically downloads a binary executable from a remote GitHub repository and executes it using `subprocess.run`. Additionally, `scripts/backend.py` and `scripts/generate_image.py` handle sensitive API keys and make outbound network requests to user-defined endpoints. While these capabilities are functionally aligned with the stated purpose of image generation and upscaling, the automated installation and execution of third-party binaries (IOC: github.com/xinntao/Real-ESRGAN-ncnn-vulkan) constitute a significant security risk without further sandboxing.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
Name/description (batch edit/generate images to platform specs) matches the code and declared requirements. The scripts implement edit/generate flows, platform specs, prompt building, optional verification, and local brand learning—all coherent with the stated purpose.
Instruction Scope
SKILL.md and scripts constrain runtime activity to: reading the input image, reading/writing a local config directory (~/.content-marketing), calling model APIs (OpenAI-compatible endpoints), optional local upscaler execution, and saving outputs. There are no instructions to read unrelated system files, harvest unrelated credentials, or transmit data to unknown endpoints.
Install Mechanism
There is no automated install spec in the registry (instruction-only install). The upscaler module offers an optional helper that downloads a Real-ESRGAN binary from a GitHub Releases URL when explicitly requested; that is a higher-risk action only performed if the user triggers installation. Minor inconsistency: the ESRGAN download URL is a Windows zip but the script places binaries under a Unix-like ~/.local/bin (may be a cross-platform oversight).
Credentials
The skill requests two API keys (OPENAI_API_KEY and GPT_IMAGE2_API_KEY) which are used for model backends and the optional AI verification step respectively. Both are directly related to calling external image/quality-checking models. No unrelated credentials, system tokens, or config paths are requested.
Persistence & Privilege
The skill stores configuration and learning/history under ~/.content-marketing and can save binaries under ~/.local/bin if the optional upscaler install is used. It does not request elevated privileges and always:false is set (no forced inclusion). Users should be aware it persists prompts, brand learning data, and possibly saved generation metadata locally.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install image-assets-resize
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /image-assets-resize 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
image-assets-resize 1.0.0 - 首次发布。支持基于参考 KV/海报/拍脸图,批量生成多平台精确尺寸图片,并自动检测裁切等问题。 - 支持多平台、多场景、品牌自定义,兼容主流中国及海外社交平台封面/物料规格。 - 内置 gpt-image-2 及 Nano Banana 图像模型,原生中文,自动处理尺寸对齐。 - 可自定义输出目录、生成质量、添加或去除元素,灵活添加自定义平台规格。 - 命令行模式并支持云端(OpenClaw)文件流转与 base64 输出,自带详细参数与用法文档。 - 增强自动 AI 自检功能,确保交付图片质量和内容完整性。
元数据
Slug image-assets-resize
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Image Assets Resize — 图片素材尺寸延展 是什么?

直接以参考KV/海报/拍脸图为输入,调用 gpt-image-2 或 Nano Banana 模型,按目标规格批量生成精确尺寸的图片文件,交付前AI自检文字裁切、元素完整性等问题。支持自定义规范学习、产品设计语言积累。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 47 次。

如何安装 Image Assets Resize — 图片素材尺寸延展?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install image-assets-resize」即可一键安装,无需额外配置。

Image Assets Resize — 图片素材尺寸延展 是免费的吗?

是的,Image Assets Resize — 图片素材尺寸延展 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Image Assets Resize — 图片素材尺寸延展 支持哪些平台?

Image Assets Resize — 图片素材尺寸延展 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Image Assets Resize — 图片素材尺寸延展?

由 OrangeMoon(@siconvip)开发并维护,当前版本 v1.0.0。

💬 留言讨论