Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
ef106ed
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
ea2bce3
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
a8cd30b
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
5ac94b7
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
1ab3cdf
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
0499102
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
df903f5
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
1baf8c8
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
ae167c8
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
64ea710
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
42e2497
feat(product-photo-studio): add product photo batch studio UI plugin
ppppp2005-p Nov 25, 2026
bcc819d
fix(product-photo-studio): report corrupt PNG/JPEG instead of a WebP/…
ppppp2005-p Nov 25, 2026
44bde6d
fix(product-photo-studio): report corrupt PNG/JPEG instead of a WebP/…
ppppp2005-p Nov 25, 2026
d9b4f09
fix(product-photo-studio): keep workspace access inside the project; …
ppppp2005-p Nov 25, 2026
bdb6c1a
fix(product-photo-studio): keep workspace access inside the project; …
ppppp2005-p Nov 25, 2026
559c4b0
fix(product-photo-studio): keep workspace access inside the project; …
ppppp2005-p Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions external_plugins/product-photo-studio/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "product-photo-studio",
"version": "0.1.0",
"description": "Batch-prepare e-commerce product photos: remove plain studio backgrounds, crop and normalise product size and position, add ground or drop shadows, and export white-background JPGs, transparent PNGs and marketplace sizes (Taobao, Amazon, Shopify, social). Tweak any photo on its own in the side panel. Runs locally; no API keys.",
"description_i18n": {
"en": "Batch-prepare e-commerce product photos: remove plain studio backgrounds, crop and normalise product size and position, add ground or drop shadows, and export white-background JPGs, transparent PNGs and marketplace sizes (Taobao, Amazon, Shopify, social). Tweak any photo on its own in the side panel. Runs locally; no API keys.",
"zh-CN": "批量处理电商商品图:去掉纯色/浅色棚拍背景,自动裁切并统一商品大小和位置,加地面柔影或投影,导出白底 JPG、透明 PNG 和各平台尺寸(淘宝、拼多多、Amazon、Shopify、社媒)。不满意的图可以在侧栏单独调整。全部本地处理,无需 API 密钥。"
},
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"keywords": [
"e-commerce",
"product-photo",
"white-background",
"remove-background",
"batch",
"taobao",
"amazon",
"shopify",
"商品图",
"白底图"
],
"skills": "skills",
"mcpServers": {
"product-photo-studio": {
"type": "stdio",
"command": "node",
"args": [
"${ZCODE_PLUGIN_ROOT}/dist/server.mjs"
],
"cwd": "${ZCODE_PROJECT_DIR}",
"timeoutMs": 900000,
"env": {
"ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}"
}
}
},
"ui": {
"surfaces": [
{
"id": "editor",
"title": {
"zh-CN": "电商商品图助手",
"en-US": "Product Photo Studio"
},
"icon": "image",
"server": "product-photo-studio",
"resourceUri": "ui://product-photo-studio/panel.html",
"availability": "session"
}
]
}
}
21 changes: 21 additions & 0 deletions external_plugins/product-photo-studio/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Penova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
50 changes: 50 additions & 0 deletions external_plugins/product-photo-studio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Product Photo Studio

Turn a batch of product photos into listing-ready images: remove plain backgrounds, make every product the same size and position, add a shadow, and export white-background main images, transparent PNGs and marketplace sizes in one go. Tweak any photo on its own in the side panel.

## What it does

- **Batch background removal**: removes plain, light or gradient studio backgrounds connected to the photo edge while keeping white labels inside the product; PNGs that already have transparency are used as-is. Edges are softened and de-fringed.
- **Consistent size and position**: crops to the product and places it by "product size" (fraction of the canvas), centred or bottom-aligned, so every product looks the same size.
- **Shadows**: soft ground ellipse or silhouette drop shadow with adjustable strength.
- **Multi-size export**: white 800×800 (Taobao/Tmall/JD), 1000×1000 (Pinduoduo/Douyin), Amazon 2000×2000, Shopify 2048×2048, social 1080×1080, Xiaohongshu 1080×1440, transparent PNG 1600×1600, plus custom sizes.
- **Per-photo tweaks**: select any photo in the panel and change tolerance, size, position, shadow or background for that photo only, then re-export just that one.
- **Warnings**: busy backgrounds, little background removed, product touching the edge, tolerance too high — flagged on the thumbnails.
- **Reusable settings**: save the batch as `.photostudio.json` and apply the same look to the next batch.

## Usage

In ZCode Desktop, ask the agent:

- "Turn every photo in products/ into 800×800 white-background main images and transparent PNGs"
- "Make all product photos the same size with a soft shadow, Amazon 2000×2000"
- "The perfume photo sits too high — lower it and export just that one again"

Or open "Product Photo Studio" from the session sidebar and tick images in the workspace. Global settings and output sizes are on the left, thumbnails in the middle; click one to adjust it below, then "Export all".

## Tools

| Tool | Purpose |
|---|---|
| `photos_open` | Open a batch (folder, paths or saved project), check it and open the panel |
| `project_save` | Save the settings as `.photostudio.json` |
| `photos_export` | Export all or some photos in the chosen sizes |

## Scope (v0.1)

- Input: JPG (auto-rotated by EXIF orientation) and PNG (with alpha).
- Background removal targets plain, light or gradient studio backdrops. **Busy backgrounds** (tables, outdoors, lifestyle shots), hair and clear glass are out of scope for v0.1: the thumbnail says "busy background", and the photo should be cut out with another tool first.
- Not yet: WebP/HEIC input, brush refinement, scene backgrounds.

## Privacy, network and file writes

- **Everything runs locally.** No network access, nothing is uploaded, no API keys or accounts.
- Reads and writes only inside the workspace: originals are never modified; results go to the output folder (default `product-photos-output/<size>/`), settings to the `.photostudio.json` you choose. No commands are executed and there are no hooks.

## Build and test (developers)

Source lives in `ui-plugins/product-photo-studio/`. From the repository root run `pnpm install --frozen-lockfile && pnpm build`, add `dist/local-marketplace` as a local source in the ZCode plugin store and install. Tests: `pnpm --filter @penova/plugin-product-photo-studio test` (real product photos plus synthetic samples; checks product fraction, centring, pure-white background and transparency) and `test:e2e` (browser panel test; point `E2E_PHOTOS` at your own photos).

## Third-party components and licenses

The plugin is MIT-licensed (author: Penova). Bundled dependencies: pngjs (MIT), jpeg-js (BSD-3-Clause), the MCP SDK and ext-apps (MIT). The full list ships in `dist/THIRD_PARTY_NOTICES.txt`. Test photo sources are listed in `ui-plugins/product-photo-studio/test/fixtures/SOURCES.md` (CC0 / public domain) and are not part of the installed package.
50 changes: 50 additions & 0 deletions external_plugins/product-photo-studio/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 电商商品图助手(Product Photo Studio)

把一批商品照片处理成可以直接上架的图片:去掉纯色背景、统一商品大小和位置、加阴影,一次导出白底主图、透明 PNG 和各平台需要的尺寸。不满意的图可以在侧栏单独调整。

## 能做什么

- **批量去背景**:去掉与照片边缘相连的纯色 / 浅色 / 渐变棚拍背景,保留商品内部的白色标签;已有透明通道的 PNG 直接使用。边缘做柔化和去色边处理。
- **统一尺寸和位置**:自动裁到商品本身,按“主体占比”放到画布中央(或底部对齐),所有图的商品大小一致。
- **阴影**:地面椭圆柔影或轮廓投影,可调浓度。
- **多尺寸导出**:白底 800×800(淘宝/天猫/京东主图)、1000×1000(拼多多/抖店)、Amazon 2000×2000、Shopify 2048×2048、社媒 1080×1080、小红书 1080×1440、透明 PNG 1600×1600,以及自定义尺寸。
- **单张调整**:在面板里选中任意一张,单独改容差、大小、位置、阴影、背景色,只重新导出这一张。
- **自动提醒**:背景复杂、几乎没去掉背景、商品贴边、容差过高等情况会在缩略图上标出。
- **设置可复用**:整批设置保存为 `.photostudio.json`,下一批商品直接套用同样的风格。

## 使用

在 ZCode Desktop 中对 Agent 说:

- “把 products 文件夹里的商品照全部做成 800×800 白底主图和透明 PNG”
- “把所有商品图统一大小、加柔和阴影,导出 Amazon 2000×2000”
- “香水那张位置太靠上了,往下挪一点,只重新导出这一张”

也可以从会话侧栏打开“电商商品图助手”,勾选工作区里的图片。左侧是全部图片的设置和输出尺寸,中间是缩略图,点一张在下方单独调整,最后点“全部导出”。

## 工具

| 工具 | 作用 |
|---|---|
| `photos_open` | 打开一批照片(文件夹、路径或已保存的项目),检查并打开面板 |
| `project_save` | 保存设置为 `.photostudio.json` |
| `photos_export` | 按所选尺寸导出全部或部分照片 |

## 支持范围(v0.1)

- 输入:JPG(自动按 EXIF 方向旋转)、PNG(含透明通道)。
- 去背景适用于纯色、浅色或渐变的棚拍背景。**复杂背景**(桌面、户外、场景图)、头发、透明玻璃不在 v0.1 范围内:缩略图会提示“背景不是纯色”,建议先用其他工具抠好透明 PNG 再放进来。
- 暂不支持:WebP / HEIC 输入、画笔精修、换场景背景。

## 隐私、网络与文件写入

- **全部在本机处理**,不联网,不上传图片,不需要任何 API 密钥或账号。
- 只读写当前工作区:原图不会被修改,结果写到输出文件夹(默认 `product-photos-output/<尺寸>/`),项目设置写到你指定的 `.photostudio.json`。不执行命令,没有 Hook。

## 构建与测试(开发者)

源码在 `ui-plugins/product-photo-studio/`。仓库根目录执行 `pnpm install --frozen-lockfile && pnpm build`,在 ZCode 插件商店添加 `dist/local-marketplace` 为本地来源后安装。测试:`pnpm --filter @penova/plugin-product-photo-studio test`(真实商品照 + 合成样本,校验主体占比、居中、白底纯白、透明背景)与 `test:e2e`(浏览器面板测试,可用 `E2E_PHOTOS` 指向自己的商品照文件夹)。

## 第三方组件与许可证

插件本身以 MIT 许可证发布(作者 Penova)。打包依赖:pngjs(MIT)、jpeg-js(BSD-3-Clause)、MCP SDK 与 ext-apps(MIT)。完整清单随安装包附在 `dist/THIRD_PARTY_NOTICES.txt`。测试照片来源见 `ui-plugins/product-photo-studio/test/fixtures/SOURCES.md`(CC0 / 公有领域),不随插件安装包分发。
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: product-photo-studio
description: 批量处理电商商品照:去纯色背景、统一商品大小与位置、加阴影,导出白底主图、透明 PNG 和淘宝/拼多多/Amazon/Shopify/社媒尺寸。用户提到“白底图 / 主图 / 商品图批量处理 / 抠图统一尺寸”时使用。
---

# 电商商品图助手

处理工作区里的 JPG / PNG 商品照,全部在本机完成。

1. **打开**:`photos_open(folder | paths, presets?)`,或 `photos_open(project: "xxx.photostudio.json")` 复用上次的设置。返回每张图的检查结果并打开侧栏面板。
- 内置尺寸 id:`white-800`(淘宝/天猫/京东主图)、`white-1000`(拼多多/抖店)、`amazon-2000`、`shopify-2048`、`square-1080`、`portrait-1080x1440`(小红书)、`transparent-png`(1600×1600 透明)。其他尺寸放进 `customPresets`。
2. **看警告**:
- `background_not_uniform`:背景不是纯色(桌面、场景图),自动去背可能不准;
- `little_background_removed`:几乎没去掉背景,建议调高该图的 tolerance;
- `subject_touches_edge`:商品贴到照片边缘,原图可能被裁掉;
- `empty_subject`:容差太高把商品也去掉了,调低 tolerance。
把这些图告诉用户,建议在面板里单独调整;本插件只能去掉与边缘相连的纯色/浅色背景,复杂背景请用户先用 PhotoCraft 等工具抠好透明 PNG(已有透明通道的 PNG 会直接使用)。
3. **调整**:全局设置在 `project.settings`;单张差异写进 `images[i].overrides`(只写不同的字段)。字段:`removeBackground`(auto/off)、`tolerance` 1–100(默认 20)、`fill` 主体占比 0.2–0.99(默认 0.85)、`offsetY` −0.4–0.4、`align` center/bottom、`shadow` none/ground/drop、`shadowOpacity` 0–1、`background` 颜色。用 `project_save(path, project)` 保存为 `.photostudio.json`,下次同一批风格直接复用。
4. **导出**:`photos_export(project, indices?)` 写到 `<outputDir>/<尺寸 id>/<原文件名>.jpg|png`;只重做某几张时传 `indices`(从 0 开始)。导出后告诉用户输出位置和仍需检查的图。

用户在面板里拖滑块即可看到预览;面板操作和你的工具调用共用同一个项目格式。不要覆盖原图。
48 changes: 48 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,54 @@
"把上一个 Hi3D 任务生成的模型按角色拆分成部件"
]
}
},
{
"name": "product-photo-studio",
"componentTypes": [
"ui"
],
"source": "./external_plugins/product-photo-studio",
"displayName": "Product Photo Studio",
"displayName_i18n": {
"en": "Product Photo Studio",
"zh-CN": "电商商品图助手"
},
"description": "Batch-prepare e-commerce product photos: remove plain studio backgrounds, crop and normalise product size and position, add ground or drop shadows, and export white-background JPGs, transparent PNGs and marketplace sizes (Taobao, Amazon, Shopify, social). Tweak any photo on its own in the side panel. Runs locally; no API keys.",
"description_i18n": {
"en": "Batch-prepare e-commerce product photos: remove plain studio backgrounds, crop and normalise product size and position, add ground or drop shadows, and export white-background JPGs, transparent PNGs and marketplace sizes (Taobao, Amazon, Shopify, social). Tweak any photo on its own in the side panel. Runs locally; no API keys.",
"zh-CN": "批量处理电商商品图:去掉纯色/浅色棚拍背景,自动裁切并统一商品大小和位置,加地面柔影或投影,导出白底 JPG、透明 PNG 和各平台尺寸(淘宝、拼多多、Amazon、Shopify、社媒)。不满意的图可以在侧栏单独调整。全部本地处理,无需 API 密钥。"
},
"version": "0.1.0",
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"category": "productivity",
"keywords": [
"e-commerce",
"product-photo",
"white-background",
"remove-background",
"batch",
"taobao",
"amazon",
"shopify",
"商品图",
"白底图"
],
"examplePrompts": [
"Turn every photo in products/ into 800×800 white-background main images and transparent PNGs",
"Make all product photos the same size with a soft shadow, Amazon 2000×2000",
"The perfume photo sits too high — lower it and export just that one again"
],
"examplePrompts_i18n": {
"zh-CN": [
"把 products 文件夹里的商品照全部做成 800×800 白底主图和透明 PNG",
"把所有商品图统一大小、加柔和阴影,导出 Amazon 2000×2000",
"香水那张位置太靠上了,往下挪一点,只重新导出这一张"
]
}
}
]
}
Loading