photo-editor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMPSTATS Photo Editor
MPSTATS 图片编辑器
Internal MPSTATS service for AI-generated visuals for marketplace product cards: background removal/replacement, upscaling, recolor, "product in action", prompt-edit, photoshoots, infographics.
All requests go through the ready-made scripts in (Bash tool, do not rewrite the code). Endpoints are asynchronous: each script handles submit → polling → saving files. Images are base64-encoded inside the scripts.
scripts/这是MPSTATS内部用于为电商商品卡片生成AI视觉内容的服务,支持背景移除/替换、图片放大、改色、「商品场景展示」、提示词编辑、拍摄图生成、信息图表制作等功能。
所有请求都通过目录下的现成脚本执行(Bash工具,请勿重写代码)。接口为异步模式:每个脚本负责提交请求 → 轮询状态 → 保存文件。图片在脚本内部以base64编码处理。
scripts/Two modes of operation
两种运行模式
Choose deliberately — it changes all downstream behavior.
A. Technical operations (single-step) — , , , , , . Run the script → get the result → deliver. No research/brief. Use when a concrete action is requested ("remove the background", "upscale", "recolor to blue").
remove-backgroundupscalereplace-backgroundin-actionrecolorfreeformB. Design tasks (multi-stage) — and . Full design work: think like a marketplace designer. Use when the request is about buyer value ("make an infographic", "refresh the card", "I need a photoshoot"). Use the stage guides in — these are thinking guides, not checklists:
infographicsphotoshootreferences/| Stage | File | When |
|---|---|---|
| 1. Research | references/01-research.md | Default for mode B unless the user chose "no research". |
| 2. Brief | references/02-brief.md | Always before generating in mode B. Also covers all prompt-craft: prompt structure, slide series, length limit, content-filter. |
| 3. Generate | references/03-generate.md | Always. Before running, ask: "the full batch right away, or a test frame first?". |
| 4. Deliver | references/04-deliver.md | Mandatory, read BEFORE showing the result. Show every frame via |
请谨慎选择——模式会改变后续所有操作流程。
A. 技术操作(单步骤) —— 对应、、、、、。运行脚本 → 获取结果 → 交付。无需调研/简报。适用于明确的操作需求(如「移除背景」「放大图片」「改为蓝色」)。
remove-backgroundupscalereplace-backgroundin-actionrecolorfreeformB. 设计任务(多阶段) —— 对应和。需要完成完整的设计工作:以电商设计师的思路思考。适用于涉及买家价值的需求(如「制作信息图表」「更新商品卡片」「我需要一套拍摄图」)。请遵循目录下的阶段指南——这些是思考框架,而非检查清单:
infographicsphotoshootreferences/| 阶段 | 文件 | 适用场景 |
|---|---|---|
| 1. 调研 | references/01-research.md | 模式B的默认流程,除非用户明确选择「无需调研」。 |
| 2. 简报 | references/02-brief.md | 模式B下生成内容前必须完成。同时涵盖所有提示词创作规则:提示词结构、幻灯片系列、长度限制、内容过滤。 |
| 3. 生成 | references/03-generate.md | 所有模式下都必须执行。运行前需询问:「直接生成全部内容,还是先出测试样图?」 |
| 4. 交付 | references/04-deliver.md | 必须执行,请在展示结果前阅读。通过 |
Mode B start — mandatory question
模式B启动——必选问题
When a task is identified as mode B, the first thing to do is ask a single question:
Run full research (competitor analysis, reviews, visual benchmark) or generate right away from your prompt / description?
Possible answers and what to do:
| User answer | Action |
|---|---|
| "with research" / "full analysis" / silence (no explicit refusal) | Run Stage 1 → 2 → 3 → 4 in full |
| "no research" / "generate right away" / "from my prompt" | Skip Stage 1, go straight to Stage 2 (brief from the user's description) → 3 → 4. State explicitly: "Skipping research — quality may be lower, but it's faster." |
| User provides a ready prompt in the message | Clarify: use it as-is or run it through the brief (length check, block structure, product lock)? |
Exception: if the user already explicitly stated "no analysis" / "no research" in the first message — don't ask, go straight to Stage 2.
当任务被判定为模式B时,首先需要询问用户一个问题:
是否需要进行完整调研(竞品分析、用户评价、视觉基准),还是直接根据您的提示词/描述生成内容?
不同回答对应的操作:
| 用户回答 | 操作 |
|---|---|
| 「需要调研」/「完整分析」/ 无明确拒绝(沉默) | 完整执行阶段1 → 2 → 3 → 4 |
| 「无需调研」/「直接生成」/「根据我的提示词」 | 跳过阶段1,直接进入阶段2(根据用户描述制作简报)→ 3 → 4。需明确告知:「将跳过调研环节——生成速度更快,但质量可能有所下降。」 |
| 用户在消息中提供现成的提示词 | 确认:直接使用该提示词,还是按照简报规则优化(长度检查、模块结构、商品锁定)? |
例外情况:如果用户在初始请求中已明确说明「无需分析」/「无需调研」——无需询问,直接进入阶段2。
Config
配置
Credentials in (gitignored): (header ) and optional (default ). Setup and variables: config/README.md.
config/.envPHOTO_EDITOR_TOKENX-Mpstats-TOKENPHOTO_EDITOR_BASE_URLhttps://mpstats.io/api/big_data/proxyIf the token is missing (or it is ), the agent must ask:
your_token_hereI need an MPSTATS API token (X-Mpstats-TOKEN) for Photo Editor — get it from your MPSTATS account → API and send it over, I'll write it into config/.env.凭证存储在(已加入git忽略)中:(请求头)和可选的(默认值为)。配置方法和变量说明:config/README.md。
config/.envPHOTO_EDITOR_TOKENX-Mpstats-TOKENPHOTO_EDITOR_BASE_URLhttps://mpstats.io/api/big_data/proxy如果缺少token(或token为),Agent必须询问:
your_token_here我需要MPSTATS Photo Editor的API令牌(X-Mpstats-TOKEN)——请从您的MPSTATS账户 → API页面获取并发送给我,我会将其写入config/.env文件。Output location
输出位置
Do NOT put results in the skill folder — the skill is code, output is data. Default , override via .
~/.claude/output/photo-editor/<event_id>/PHOTO_EDITOR_OUTPUT_DIRFor mode B, after generation copy the files into a clean per-SKU folder with meaningful names (, etc.) — contains , which breaks image rendering in some UI clients, and per-SKU is easier for the user to navigate.
slide_1_hero.pngevent_id:请勿将结果存入技能文件夹——技能是代码,输出属于数据。默认路径为,可通过变量覆盖。
~/.claude/output/photo-editor/<event_id>/PHOTO_EDITOR_OUTPUT_DIR对于模式B,生成完成后请将文件复制到按SKU划分的独立文件夹中,并使用有意义的文件名(如等)——包含冒号,可能导致部分UI客户端无法渲染图片,而按SKU划分更便于用户浏览。
slide_1_hero.pngevent_id:Multi-angle input: wb:<sku>
wb:<sku>多角度输入:wb:<sku>
wb:<sku>In and the first argument can be or instead of a file path. The skill downloads all product photos from the WB CDN (, cached in ): the first → , the rest → (max 5, the API won't accept more).
infographics.shphotoshoot.shwb:<sku>wb:<wb-url>wb-fetch-photos.sh~/.claude/cache/photo-editor/wb-photos/<sku>/main_imagereference_imagesbash
infographics.sh generate wb:164419278 "$PROMPT" 5For multi-angle input, in the product-lock instruction write "preserve product identity", NOT "preserve same orientation" — otherwise the model copies the first photo's angle onto every slide. More on the prompt — .
references/02-brief.md在和中,第一个参数可以是或,而非文件路径。技能会从WB CDN下载该商品的所有图片(通过脚本,缓存于):第一张图作为,其余作为(最多5张,API不接受更多)。
infographics.shphotoshoot.shwb:<sku>wb:<wb-url>wb-fetch-photos.sh~/.claude/cache/photo-editor/wb-photos/<sku>/main_imagereference_imagesbash
infographics.sh generate wb:164419278 "$PROMPT" 5对于多角度输入,在商品锁定说明中请写「保留商品辨识度」,而非「保留相同角度」——否则模型会将第一张图的角度复制到所有幻灯片中。更多提示词相关说明请参考。
references/02-brief.mdInfographics: a series of N slides
信息图表:N张幻灯片系列
infographics.sh generate <img> "<prompt>" <count>counttestgenerate <N>autoMinimum output is 4 frames. The endpoint always returnsimages — requesting count=1..3 still yields 4. Photoshoot has no such limit.max(4, image_count)
The prompt sets the high-level direction + frame themes, not the layout of each slide — otherwise you get a 2×3 collage on a single canvas. Prompt-craft details — .
references/02-brief.mdinfographics.sh generate <img> "<prompt>" <count>counttestgenerate <N>auto最少输出4张图。接口始终返回张图片——即使请求1-3张,仍会返回4张。拍摄图无此限制。max(4, image_count)
提示词需设定整体方向+单图主题,而非每张幻灯片的布局——否则会在单张画布上生成2×3的拼接图。提示词创作细节请参考。
references/02-brief.mdModels
模型
| Mask | Tier | Default | Aspect ratios | Available for |
|---|---|---|---|---|
| Standard | ✅ all except infographics | 1:1, 3:4, 4:3, 2:3, 3:2 | all endpoints |
| PRO | ✅ infographics | 1:1, 3:4, 4:3, 2:3, 3:2 | all endpoints |
| PRO | — | 1:1, 3:4, 4:3, 2:3, 3:2 | all endpoints |
| PRO | — | 1:1, 3:4, 4:3, 2:3, 3:2 | all endpoints |
| PRO | — | 1:1, 3:4, 4:3 | freeform, photoshoot |
The backend does not accept — the skill resolves it to (Standard). For infographics the default is hard-wired to (PRO) — best Cyrillic quality. Specify an explicit model only if you have a hypothesis why.
model=automodel_1model_2| 标识 | 等级 | 默认适用场景 | 宽高比 | 支持的接口 |
|---|---|---|---|---|
| 标准版 | ✅ 除信息图表外的所有场景 | 1:1、3:4、4:3、2:3、3:2 | 所有接口 |
| PRO版 | ✅ 信息图表 | 1:1、3:4、4:3、2:3、3:2 | 所有接口 |
| PRO版 | — | 1:1、3:4、4:3、2:3、3:2 | 所有接口 |
| PRO版 | — | 1:1、3:4、4:3、2:3、3:2 | 所有接口 |
| PRO版 | — | 1:1、3:4、4:3 | freeform、photoshoot |
后端不接受参数——技能会自动将其解析为(标准版)。信息图表默认使用(PRO版)——西里尔文字符质量最优。仅当有明确理由时才指定特定模型。
model=automodel_1model_2Scripts
脚本列表
| Script | When to use |
|---|---|
| Remove the background |
| Increase resolution |
| Place the product on a stock background |
| Product in a ready usage scene |
| Recolor the product |
| Freeform edit (single-step) |
| Photoshoot (test → generate in one command) |
| When you need to approve the test frame separately |
| Infographics (test → generate) |
| Same as photoshoot |
| List |
| List |
| Download WB product photos. Called automatically on |
| Check the service |
| Universal submit + poll |
| Wait for a ready event_id |
| 脚本 | 使用场景 |
|---|---|
| 移除背景 |
| 提升分辨率 |
| 将商品放置在预设背景上 |
| 生成商品使用场景图 |
| 为商品改色 |
| 自由编辑(单步骤) |
| 拍摄图生成(测试+生成一键完成) |
| 需要单独确认测试样图时使用 |
| 信息图表生成(测试+生成一键完成) |
| 与拍摄图脚本逻辑相同 |
| 列出 |
| 列出 |
| 下载WB商品图片。使用 |
| 检查服务状态 |
| 通用提交+轮询脚本 |
| 等待指定event_id的任务完成 |
Decision Guide
决策指南
- "clean up the background" → A,
remove-background.sh - "make it bigger/sharper" → A,
upscale.sh - "change the background to a studio/marble" → A, →
templates.sh backgroundsreplace-background.sh - "show the product in use" → A, →
templates.sh in-actionin-action.sh - "recolor to #hex" → A,
recolor.sh - "fix the lighting / remove the glare / add a shadow" → A,
freeform.sh - "make an infographic / photoshoot", "refresh product card X" → B, start with
references/01-research.md
- 「清理背景」→ 模式A,使用
remove-background.sh - 「放大/锐化图片」→ 模式A,使用
upscale.sh - 「将背景改为工作室/大理石纹理」→ 模式A,先执行再使用
templates.sh backgroundsreplace-background.sh - 「展示商品使用场景」→ 模式A,先执行再使用
templates.sh in-actionin-action.sh - 「改为#hex颜色」→ 模式A,使用
recolor.sh - 「调整光线/去除反光/添加阴影」→ 模式A,使用
freeform.sh - 「制作信息图表/拍摄图」「更新商品卡片X」→ 模式B,从开始执行
references/01-research.md
Errors
错误处理
| msg | What to do |
|---|---|
| Done, files saved |
| Content-filter → rephrase the prompt ( |
| Read |
| The server didn't finish in time; reduce count or change the model |
| Most often the cause is line breaks ( |
| Invalid credentials — see the Config section |
| Local poll timeout | The script stopped polling; the event_id remains — |
| 消息 | 处理方式 |
|---|---|
| 任务完成,文件已保存 |
| 内容被过滤 → 重新调整提示词(参考 |
| 读取 |
| 服务器未按时完成任务;减少生成数量或更换模型 |
| 最常见原因是提示词中的换行符( |
| 凭证无效 → 参考配置部分 |
| 本地轮询超时 | 脚本停止轮询;event_id仍有效 → 使用 |