Skip to content

feat(product-photo-studio): add product photo batch studio UI plugin - #217

Open
ppppp2005-p wants to merge 16 commits into
zai-org:mainfrom
ppppp2005-p:feat/product-photo-studio
Open

ppppp2005-p wants to merge 16 commits into
zai-org:mainfrom
ppppp2005-p:feat/product-photo-studio

Conversation

@ppppp2005-p

Copy link
Copy Markdown

Plugin type (required) / 插件类型(必填)

  • UI Plugin / 是 UI 插件 — provides MCP Apps interactive pages / 提供 MCP Apps 交互页面
  • Standard plugin / 普通插件(非 UI)
  • Not applicable / 不适用

Affected plugin name(s) / 涉及的插件名称:product-photo-studio (UI Plugin, new)

What / 改动内容

New community UI plugin Product Photo Studio / 电商商品图助手: batch-prepare e-commerce product photos.

  • Side panel (ui://product-photo-studio/panel.html): global settings (background removal tolerance, product size, vertical offset, alignment, ground/drop shadow, background colour), output-size checklist with custom sizes, thumbnail grid with warning flags, per-photo override editor with a large live preview, export all / export one.
  • Tools: photos_open, project_save, photos_export (+ app-only photos_preview, photo_thumbs, workspace_images).
  • Local background removal for plain / light / gradient studio backdrops (edge-seeded flood fill with local + global colour tolerance, small-island cleanup, edge softening and de-fringing); PNGs with alpha are used as-is; JPEG EXIF orientation honoured. Busy backgrounds are flagged rather than silently mangled.
  • Presets: white 800×800 (Taobao/Tmall/JD), 1000×1000 (Pinduoduo/Douyin), Amazon 2000×2000, Shopify 2048×2048, 1080×1080, 1080×1440 (Xiaohongshu), transparent PNG 1600×1600, custom.
  • Reusable .photostudio.json projects.

Network / API / side effects: local stdio MCP server only; no network, no API keys, no hooks, no command execution; originals are never modified; writes only to the output folder (default product-photos-output/<size>/) and the chosen project file.

Third-party: pngjs (MIT), jpeg-js (BSD-3-Clause), MCP SDK / ext-apps (MIT); notices generated into dist/THIRD_PARTY_NOTICES.txt. Test photos: Wikimedia Commons CC0 / public domain (see test/fixtures/SOURCES.md), not shipped in the package.

Tests: vitest over MCP (product fraction within 2 %, centring within 10 px, pure-white corners, transparent background, per-photo override, custom size, path escape rejected); Chrome e2e with the official AppBridge host on 8 real product photos (sneakers on black, headphones on grey gradient, perfume, backpack, canvas shoe on textured floor…): open folder, change global settings, adjust one photo, transparent preview, export all. validate.py, build_dist.py, git diff --check, oxlint, tsc pass.

A ZCode Desktop demo recording is attached in the comments. / ZCode 桌面版演示录屏见评论。

Self-check / 自查清单

  • Plugin name is unique kebab-case; new external plugin directory is external_plugins/<name>/
  • Usage category is set (productivity)
  • Plugin type and affected names are declared above
  • version 0.1.0 in both plugin.json and marketplace.json
  • README.md (EN) and README_CN.md (中文) both provided and equivalent
  • description_i18n has both en and zh-CN
  • No secrets, machine-specific paths, or private dependencies
  • Model/API/network dependencies documented
  • python3 scripts/validate.py and python3 scripts/build_dist.py pass locally
  • Exercised in ZCode Desktop (ZCode 4.0.0, macOS arm64: installed from a local marketplace, photos_open → side panel → per-photo override → project_save → photos_export; demo video in the comments)

Known limitation seen in the ZCode run: background enclosed by the product (e.g. the inside of a headphone band) is not connected to the photo edge, so it is kept; the skill tells the agent to flag such photos for manual cleanup.

@ppppp2005-p

Copy link
Copy Markdown
Author

ZCode desktop demo (ZCode 4.0.0, macOS arm64)

pps-final.mp4

Flow shown:

  1. Installed product-photo-studio from a local marketplace built from this PR's branch.
  2. Asked ZCode to process photos/ (6 product photos) with the white-800 and transparent-png presets and a ground shadow. The agent called photos_open, which opened the side panel (6 photos, global settings, output sizes); the panel's own calls (workspace_images, photos_preview) ran in the panel.
  3. Edited one photo: perfume.jpg gets a per-photo override fill: 0.7, saved with project_save as photos.photostudio.json.
  4. photos_export wrote 12 files to product-photos-output/white-800/ and product-photos-output/transparent-png/; the agent measured the perfume fill at 0.695 and checked the shadows. The last card shows the exported 800×800 JPGs.

Note: ZCode asks for approval for every tool call in "Ask before changes" mode, including the panel's app-only read-only tools, so the video shows several approval prompts ("Always allow in this project" was used).

演示流程:本地 marketplace 安装 → photos_open 打开侧栏面板 → 单张香水图占比改为 0.7 并保存项目 → photos_export 导出白底 800 和透明 PNG 共 12 个文件。

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

@panda920

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants