{"id":"77116efb-6b7d-4ad2-a419-3aa9eb710d29","entityType":"agent","slug":"clawhub-dlazyai-item-change-background","name":"商品换背景 Item Change Background","canonicalUrl":"https://www.xpersona.co/agent/clawhub-dlazyai-item-change-background","canonicalPath":"/agent/clawhub-dlazyai-item-change-background","generatedAt":"2026-10-10T23:47:01.514Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T20:46:43.719Z","emptyReason":null},"description":"商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。 Skill: 商品换背景 Item Change Background Owner: dlazyai Summary: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。 Tags: latest:1.0.19 Version history: v1.0.19 | 2026-10-10T01:51:18.661Z | user 例行版本更新 2026-10-10 v1.0.18 | 2026-10-08T01:43:55.300Z | user 例行版本更新 2026-10-08 v1.0.17 | 2026-10-04T01:43:54.013Z | user 例行版本更新 2026-10-04 v1.0.16 | 2026-10-02T05:16:32.193Z | user 例行版本更新 2026-10-02 v1.0.15 | 2026-09-3","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s170j1ymymrxasgd00dsk7tckx84cf45:item-change-background","sourceUrl":"https://clawhub.ai/dlazyai/item-change-background","homepage":"https://clawhub.ai/dlazyai/skills/item-change-background","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/dlazyai/item-change-background","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/dlazyai/skills/item-change-background","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":62,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。 Skill: 商品换背景 Item Change Background Owner: dlazyai Summary: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T20:46:43.719Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T20:46:43.719Z","emptyReason":null},"stars":null,"forks":null,"downloads":1262,"packageName":null,"latestVersion":"1.0.19","tractionLabel":"1.3K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T20:46:43.705Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T20:46:43.719Z","lastCrawledAt":"2026-10-10T20:46:43.705Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T20:46:43.705Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.19","createdAt":"2026-10-10T01:51:18.661Z","changelog":"例行版本更新 2026-10-10","fileCount":11,"zipByteSize":25448},{"version":"1.0.18","createdAt":"2026-10-08T01:43:55.300Z","changelog":"例行版本更新 2026-10-08","fileCount":11,"zipByteSize":25380},{"version":"1.0.17","createdAt":"2026-10-04T01:43:54.013Z","changelog":"例行版本更新 2026-10-04","fileCount":11,"zipByteSize":25397},{"version":"1.0.16","createdAt":"2026-10-02T05:16:32.193Z","changelog":"例行版本更新 2026-10-02","fileCount":11,"zipByteSize":25412},{"version":"1.0.15","createdAt":"2026-09-30T01:47:45.233Z","changelog":"例行版本更新 2026-09-30","fileCount":11,"zipByteSize":25461},{"version":"1.0.14","createdAt":"2026-09-28T02:37:01.679Z","changelog":"例行版本更新 2026-09-28","fileCount":11,"zipByteSize":25425},{"version":"1.0.13","createdAt":"2026-09-24T02:38:15.445Z","changelog":"例行版本更新 2026-09-24","fileCount":11,"zipByteSize":25647},{"version":"1.0.12","createdAt":"2026-09-22T01:41:40.756Z","changelog":"例行版本更新 2026-09-22","fileCount":11,"zipByteSize":25564}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s170j1ymymrxasgd00dsk7tckx84cf45:item-change-background","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T23:47:01.511Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-dlazyai-item-change-background/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T20:46:43.719Z","emptyReason":null},"readme":"Skill: 商品换背景 Item Change Background\n\nOwner: dlazyai\n\nSummary: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n\nTags: latest:1.0.19\n\nVersion history:\n\nv1.0.19 | 2026-10-10T01:51:18.661Z | user\n\n例行版本更新 2026-10-10\n\nv1.0.18 | 2026-10-08T01:43:55.300Z | user\n\n例行版本更新 2026-10-08\n\nv1.0.17 | 2026-10-04T01:43:54.013Z | user\n\n例行版本更新 2026-10-04\n\nv1.0.16 | 2026-10-02T05:16:32.193Z | user\n\n例行版本更新 2026-10-02\n\nv1.0.15 | 2026-09-30T01:47:45.233Z | user\n\n例行版本更新 2026-09-30\n\nv1.0.14 | 2026-09-28T02:37:01.679Z | user\n\n例行版本更新 2026-09-28\n\nv1.0.13 | 2026-09-24T02:38:15.445Z | user\n\n例行版本更新 2026-09-24\n\nv1.0.12 | 2026-09-22T01:41:40.756Z | user\n\n例行版本更新 2026-09-22\n\nv1.0.11 | 2026-09-20T01:51:00.961Z | user\n\n例行版本更新 2026-09-20\n\nv1.0.10 | 2026-09-18T02:11:55.601Z | user\n\n例行版本更新 2026-09-18\n\nv1.0.9 | 2026-09-14T01:42:01.199Z | user\n\n例行版本更新 2026-09-14\n\nv1.0.8 | 2026-09-10T01:35:29.097Z | user\n\n例行版本更新 2026-09-10\n\nv1.0.7 | 2026-09-08T01:42:19.074Z | user\n\n例行版本更新 2026-09-08\n\nv1.0.6 | 2026-09-07T01:50:03.019Z | user\n\n例行版本更新 2026-09-07\n\nv1.0.5 | 2026-09-04T01:43:07.437Z | user\n\n例行版本更新 2026-09-04\n\nv1.0.4 | 2026-09-02T01:38:49.110Z | user\n\n例行版本更新 2026-09-02\n\nv1.0.3 | 2026-08-31T07:05:29.226Z | user\n\n源码仓库迁移至 github.com/dlazy-ai/ecommerce-skills\n\nv1.0.2 | 2026-08-31T05:26:18.107Z | user\n\n源码仓库迁移至 github.com/dlazy-ai/ecommerce-skills\n\nv1.0.1 | 2026-08-29T04:05:57.516Z | user\n\nSync from GitHub\n\nv1.0.0 | 2026-08-18T04:41:21.970Z | user\n\nSync from GitHub\n\nArchive index:\n\nArchive v1.0.19: 11 files, 25448 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2025b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.19:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.19\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.19:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.19\",\n  \"publishedAt\": 1791597078661\n}\n\nFile v1.0.19:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.19:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.19:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.19:skill-card.md\n\n## Description:\n\nHelps turn plain-background product photos into realistic lifestyle scenes with matched lighting, reflections, and contact shadows while preserving product details.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nE-commerce creators and marketers use this skill to place product photos into believable commercial scenes while retaining the product's appearance.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Product photos, prompts, and optional brand references may be sent to a chosen cloud image provider.\n\nMitigation: Check that provider's privacy and retention terms before uploading sensitive or unreleased assets.\n\nRisk: Generated scenes may alter product details or suggest an implausible use.\n\nMitigation: Review outputs for product fidelity, credible lighting and shadows, and non-misleading placement before publishing.\n\nRisk: Image generation may incur provider charges.\n\nMitigation: Use dry-run and configuration checks before making paid generation calls.\n\n## Reference(s):\n\n- [Image model options](artifact/references/model-flags.md)\n- [Provider CLI and data flow](artifact/references/provider-cli.md)\n- [dLazy CLI source](https://github.com/dlazy-ai/cli)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration guidance]\n\n**Output Format:** [Markdown with prompt templates and shell command examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Commands can generate and save product-scene images through a configured image provider.]\n\n## Skill Version(s):\n\n1.0.19 (source: frontmatter and server-resolved release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.19:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.18: 11 files, 25380 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (1810b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.18:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.18\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.18:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.18\",\n  \"publishedAt\": 1791423835300\n}\n\nFile v1.0.18:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.18:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.18:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.18:skill-card.md\n\n## Description:\n\nPlaces product photos into realistic scenes with matching lighting, reflections, and contact shadows.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nE-commerce teams and product marketers use this skill to create lifestyle scenes from product photos while aiming to preserve the product's appearance.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Product images and prompts may be sent to a cloud image provider.\n\nMitigation: Confirm the provider is approved for the assets, use a dry run where possible, and keep API keys scoped and revocable.\n\nRisk: Generated images may change product details or suggest misleading product use.\n\nMitigation: Review product features and scene realism before publishing; reject altered products or unsupported usage scenes.\n\n## Reference(s):\n\n- [ClawHub skill release](https://clawhub.ai/dlazyai/skills/item-change-background)\n- [Provider CLI reference](references/provider-cli.md)\n- [Image model options](references/model-flags.md)\n- [dLazy CLI](https://github.com/dlazy-ai/cli)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Shell commands]\n\n**Output Format:** [Markdown with command examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Image-generation commands can save edited product images as JPEG, PNG, or WebP files.]\n\n## Skill Version(s):\n\n1.0.18 (source: frontmatter and ClawHub release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.18:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.17: 11 files, 25397 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (1889b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.17:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.17\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.17:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.17\",\n  \"publishedAt\": 1791078234013\n}\n\nFile v1.0.17:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.17:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.17:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.17:skill-card.md\n\n## Description:\n\nPlaces product photos into realistic scenes while aiming to preserve product details and match lighting, reflections, and shadows.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nE-commerce creators and marketers use this skill to place product photos into realistic lifestyle scenes or supplied backgrounds for listings and promotional imagery.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Selected product images, prompts, and optional background images are sent to the configured cloud provider.\n\nMitigation: Use a dry run to inspect the request, avoid sensitive unreleased assets unless provider terms allow them, and keep API keys scoped and revocable.\n\nRisk: Generated scenes may alter product details or imply misleading uses.\n\nMitigation: Compare each result with the original product and review scene plausibility before publishing.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/dlazyai/skills/item-change-background)\n- [Provider CLI reference](references/provider-cli.md)\n- [Image model flags](references/model-flags.md)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Shell commands, Configuration]\n\n**Output Format:** [Markdown with prompts and shell commands]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [When executed, saves generated product images locally; a dry run previews the request without generation.]\n\n## Skill Version(s):\n\n1.0.17 (source: frontmatter and server-resolved release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.17:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.16: 11 files, 25412 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (1964b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.16:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.16\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.16:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.16\",\n  \"publishedAt\": 1790918192193\n}\n\nFile v1.0.16:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.16:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.16:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.16:skill-card.md\n\n## Description:\n\nHelps turn product photos on plain backgrounds into realistic lifestyle scenes with matching lighting, reflections, and contact shadows.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nE-commerce teams use this skill to place existing product photos into suitable lifestyle settings while aiming to preserve product details and match the scene's lighting.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Product images and prompts are sent to the selected image-generation provider.\n\nMitigation: Choose the provider deliberately; avoid confidential unreleased assets unless its terms and account controls are acceptable.\n\nRisk: Image-generation requests may incur costs.\n\nMitigation: Use --dry-run first to inspect the request and estimated cost.\n\nRisk: Generated scenes may change product details or imply an unsuitable use.\n\nMitigation: Review product fidelity, lighting, shadows, and scene suitability before publishing.\n\n## Reference(s):\n\n- [ClawHub skill release](https://clawhub.ai/dlazyai/skills/item-change-background)\n- [Provider and CLI reference](references/provider-cli.md)\n- [Image model parameters](references/model-flags.md)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Shell commands]\n\n**Output Format:** [Markdown with prompt and command examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Executing the commands can generate product scene image files; review results before publication.]\n\n## Skill Version(s):\n\n1.0.16 (source: frontmatter and server-resolved release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.16:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.15: 11 files, 25461 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2020b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.15:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.15\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.15:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.15\",\n  \"publishedAt\": 1790732865233\n}\n\nFile v1.0.15:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.15:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.15:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.15:skill-card.md\n\n## Description:\n\nTurns product photos on plain backgrounds into realistic lifestyle scenes with matched lighting, reflections, and contact shadows.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nMerchants, product photographers, and designers use this skill to place product images into plausible scenes for e-commerce visuals while preserving product details.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Product images and prompts are sent to the selected cloud image provider.\n\nMitigation: Use only images approved for cloud processing; do not submit confidential or internal image URLs.\n\nRisk: Image-generation requests may incur charges or expose provider credentials.\n\nMitigation: Preview requests with dry-run before paid calls, and use scoped, revocable API keys.\n\nRisk: Related task profiles may include watermark removal outside this skill's purpose.\n\nMitigation: Avoid unrelated profiles unless you have explicit rights and a legitimate need.\n\n## Reference(s):\n\n- [ClawHub skill release](https://clawhub.ai/dlazyai/skills/item-change-background)\n- [Provider CLI reference](references/provider-cli.md)\n- [Image model parameters](references/model-flags.md)\n\n## Skill Output:\n\n**Output Type(s):** [Images, Shell commands, Guidance]\n\n**Output Format:** [JPEG product scene images, with optional JSON results and Markdown guidance]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Saved image paths or hosted image URLs; review product fidelity and scene realism before publication.]\n\n## Skill Version(s):\n\n1.0.15 (source: skill frontmatter and server-resolved release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.15:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.14: 11 files, 25425 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (1993b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.14:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.14\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.14:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.14\",\n  \"publishedAt\": 1790563021679\n}\n\nFile v1.0.14:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.14:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.14:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-video-ad\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"ugc-testimonial\":         { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true }\r\n  }\r\n}\n\nFile v1.0.14:skill-card.md\n\n## Description:\n\nTurns product photos on plain backgrounds into photorealistic lifestyle scenes with matching lighting and grounded shadows.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[dlazyai](https://clawhub.ai/user/dlazyai)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nSellers and creative teams use this skill to place product photos into realistic scenes while preserving product details and matching shadows, reflections, and lighting.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Selected product images and prompts are sent to the configured cloud image provider.\n\nMitigation: Inspect requests with --dry-run, choose an explicit provider and save path, and avoid confidential images when third-party processing is not allowed.\n\nRisk: Provider API credentials may remain valid after access changes.\n\nMitigation: Rotate or revoke API keys when access changes.\n\nRisk: Generated scenes may alter product details or produce mismatched lighting and shadows.\n\nMitigation: Review generated images for product fidelity, grounded contact shadows, consistent lighting, and clean edges before use.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/dlazyai/skills/item-change-background)\n- [Provider CLI guide](references/provider-cli.md)\n- [Image model options](references/model-flags.md)\n\n## Skill Output:\n\n**Output Type(s):** [Guidance, Shell commands]\n\n**Output Format:** [Markdown with shell commands and image-editing prompts]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Configured image providers generate scene images that can be saved locally.]\n\n## Skill Version(s):\n\n1.0.14 (source: frontmatter, server release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.14:examples/brand.yaml\n\n# ⚠️ 由 scripts/build-skills.mjs 从 shared/examples/brand.yaml 同步生成，不要直接改这里。\r\n# 店铺品牌视觉规范 —— 所有生图技能读这一份，保证几百个 SKU 看起来像同一家店。\r\n#   node scripts/brand.mjs --brand brand.yaml --for flat-lay\r\n#   node scripts/gen.mjs --task flat-lay --brand brand.yaml --prompt '...'\r\n\r\nbrand:\r\n  name: 示例品牌\r\n  # 一句话概括调性，会原样进 prompt\r\n  tone: quiet minimalist, warm and lived-in, never glossy or commercial\r\n\r\nmodel:\r\n  # 锁模特：给一张脸的参考图，所有技能都会把它作为最后一张参考图传入\r\n  reference: assets/model/face-a.jpg\r\n  description: East Asian woman, late twenties, natural makeup, shoulder-length black hair\r\n  body: slim, height around 168cm\r\n\r\nphotography:\r\n  background: seamless off-white studio backdrop, RGB 248 248 246\r\n  lighting: soft large softbox from camera left, gentle fill, no hard shadows\r\n  camera: 85mm equivalent, eye level, shallow depth of field\r\n  grade: neutral white balance around 5200K, low contrast, slightly lifted blacks\r\n  crop: full body with headroom, product centered\r\n\r\nlayout:\r\n  # 给带排版的技能（主图 / 详情页）用\r\n  margin: at least 8% empty margin on all sides\r\n  typeface: clean sans-serif, no decorative fonts\r\n  text_color: near-black on light background\r\n\r\nforbid:\r\n  - no visible brand logos other than the product's own\r\n  - no text or watermark\r\n  - no exaggerated poses or dramatic wind effects\r\n  - no oversaturated colors\r\n\r\n# 可选：把这些直接写进合规目标，生成时就按平台要求出图\r\ncompliance:\r\n  platform: amazon\n\nArchive v1.0.13: 11 files, 25647 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2227b), SKILL.md (11747b), _meta.json (142b)\n\nFile v1.0.13:SKILL.md\n\n---\nname: item-change-background\nversion: 1.0.13\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模型；商品换背景的难点是「商品像素不动 + 环境重建 + 物理正确的光影耦合」，需要强区域保持与场景理解）。\n\n### 调用方式\n\n两种等价写法，选一种。统一入口会自动选后端、失败重试、建目录落盘、估算成本：\n\n```bash\n# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg\n```\n\n**参数约定（本技能固定用法）**\n\n| 参数 | 取值 | 理由 |\n| --- | --- | --- |\n| `--images` | `[商品图]`（文生背景）/ `[商品图, 背景图]`（上传背景） | 顺序即 prompt 中的 image 1 / 2 |\n| `--size` | `1024x1024`（方图主图）/ `1024x1536`（竖版场景） | 跟随主图规范 |\n| `--quality` | `high`（皮革、金属、玻璃等反光材质）/ `medium`（哑光材质） | 反光材质靠 high |\n| `--imageFormat` | `jpeg` | 通用格式 |\n| `--batch` | `2` ~ `4` | 场景构图随机性大 |\n| `--save` | `docs/item-change-background/output-<sku>-<场景>.jpg` | 按场景归档 |\n\n### Command Examples\n\n```bash\n# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --batch 2 --save \"docs/item-change-background/output-sku001-$S.jpg\"\ndone\n\n# 上传背景图的写法：--images 商品图 背景图\ndlazy gpt-image-2 \\\n  --prompt 'Composite the product from image 1 into the scene from image 2. Keep the product 100% faithful. Place it on [具体位置] with correct perspective, a grounded contact shadow, and light direction matching image 2. Blend edges seamlessly; no cut-out halo. Photorealistic, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg docs/item-change-background/bg.jpg \\\n  --size 1024x1024 --quality high\n\n# 先估价不真跑\ndlazy gpt-image-2 --dry-run --prompt '...' --images a.jpg --size 1024x1024 --quality high\n```\n\n### 延伸阅读\n\n| 要查什么 | 去哪 |\n| --- | --- |\n| 认证、多后端配置、输出结构、错误码 | [`references/provider-cli.md`](references/provider-cli.md) |\n| `gpt-image-2` 的全部可用参数 | [`references/model-flags.md`](references/model-flags.md) |\n| 统一入口的全部选项 | `node scripts/gen.mjs --help` |\n\n## 5、Prompt 模板\n\n```text\nPlace this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark.\n```\n\n**按问题追加的修正句**\n\n| 问题 | 追加到 prompt 末尾 |\n| --- | --- |\n| 商品像贴纸浮着 | `Add a soft occlusion/contact shadow where the product meets the surface, and a faint ambient-occlusion darkening along the contact line.` |\n| 光向对不上 | `The scene light must come from [方向], matching the highlight already on the product.` |\n| 抠图有白边 | `Blend the product edges seamlessly into the scene; no cut-out halo, no white fringe.` |\n| 商品被改了 | `Change only the background. Every pixel of the product must remain identical to image 1.` |\n| 反光材质假 | `Render physically plausible reflections of the surrounding scene on the [材质] surface.` |\n| 商品太小 | `The product must occupy at least 45% of the frame and be the sharpest element.` |\n\n---\n\n## 6、执行流程\n\n1. **洗成白底**：商品图如带复杂背景，先抠干净。\n2. **查类目 → 合理场景**（第三节表格），避免物理上不成立的组合。\n3. **写商品保真句** → **写场景句** → **写三条物理约束**（接地 / 光向 / 反光）。\n4. **反光材质用 `--quality high`**。\n5. **`--batch 2~4`** 出多张挑构图，落盘到 `docs/item-change-background/`。\n6. **质检**：是否接地（有没有投影和压痕）、光向是否一致、边缘有没有白边、商品本体是否被改。\n\n---\n\n## 7、常见问题\n\n| 现象 | 原因 | 处理 |\n| --- | --- | --- |\n| 商品像浮在背景上 | 缺接地投影 | 追加接地投影 + AO 暗化句 |\n| 光向明显矛盾 | 未约束光向 | 追加指定光向句，与商品原有高光一致 |\n| 边缘有白边 | 抠图残留 | 追加无白边融合句 |\n| 商品细节被改 | 模型重绘了商品 | 追加 `Change only the background.` |\n| 玻璃/金属反光很假 | 缺环境反光 | 追加环境反光句 + `--quality high` |\n| 场景不合理（鞋在草地悬空） | 类目与场景不匹配 | 查第三节表格换场景 |\n\n---\n\n## Tips\n\nVisit https://dlazy.com for more information.\n\nFile v1.0.13:_meta.json\n\n{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.13\",\n  \"publishedAt\": 1790217495445\n}\n\nFile v1.0.13:references/model-flags.md\n\n# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。\n\nFile v1.0.13:references/provider-cli.md\n\n<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTTP status code error (500)` |\n| 504 | 异步任务失败 | `=== Generation Failed ===` / `Prompt violates safety policy` |\n\n**给 Agent 的硬性要求**\n\n1. 命中 `insufficient_balance` → 明确告诉用户算力不足，并给出充值入口\n   <https://dlazy.com/dashboard/organization/settings?tab=credits>\n2. 命中 `unauthorized` / 缺 key → 告诉用户去 <https://dlazy.com/dashboard/organization/api-key>\n   取 key，用 `dlazy auth set <key>` 存好再继续。\n3. 用 `gen.mjs` 时，429 与 5xx 已自动重试；仍失败才向用户报错。\n4. **不要**为了「跑通」而偷偷降级参数（尺寸、档位、批量），先问用户。\n\nFile v1.0.13:scripts/lib/tasks.json\n\n{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-\n\nArchive v1.0.12: 11 files, 25564 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2317b), SKILL.md (11747b), _meta.json (142b)\n\nArchive v1.0.11: 11 files, 25628 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2557b), SKILL.md (11747b), _meta.json (142b)\n\nArchive v1.0.10: 11 files, 25743 bytes\n\nFiles: examples/brand.yaml (1655b), references/model-flags.md (2144b), references/provider-cli.md (4802b), scripts/brand.mjs (4516b), scripts/gen.mjs (9733b), scripts/lib/miniyaml.mjs (2901b), scripts/lib/providers.mjs (12510b), scripts/lib/tasks.json (3234b), skill-card.md (2444b), SKILL.md (11747b), _meta.json (142b)","readmeExcerpt":"Skill: 商品换背景 Item Change Background Owner: dlazyai Summary: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。 Tags: latest:1.0.19 Version history: v1.0.19 | 2026-10-10T01:51:18.661Z | user 例行版本更新 2026-10-10 v1.0.18 | 2026-10-08T01:43:55.300Z | user 例行版本更新 2026-10-08 v1.0.17 | 2026-10-04T01:43:54.013Z | user 例行版本更新 2026-10-04 v1.0.16 | 2026-10-02T05:16:32.193Z | user 例行版本更新 2026-10-02 v1.0.15 | 2026-09-3","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"dlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg"},{"language":"text","snippet":"1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene"},{"language":"bash","snippet":"# A. 统一入口（推荐）：可切任意后端，加 --dry-run 不计费空跑\nnode scripts/gen.mjs --task item-change-background \\\n  --prompt '<见下方 Prompt 模板>' \\\n  --images <按下表顺序> \\\n  --save output/item-change-background-<sku>.jpg\n\n# B. 直接用 dLazy CLI（不想引入 Node 依赖时，效果等价）\ndlazy gpt-image-2 --prompt '...' --images ... --save output/item-change-background.jpg"},{"language":"bash","snippet":"# basic call: 文生背景\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the product 100% faithful: same shape, colour, material finish and logo. Replace the plain background with a weathered wooden floor beside a window, soft late-afternoon side light casting a natural contact shadow, blurred indoor background. The product must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium\n\n# complex call: 上传背景图 + 一个商品铺 4 个场景\nSRC=docs/item-change-background/product-shoes.jpg\nKEEP='Keep the pair of black crocodile-embossed patent leather derby shoes 100% faithful: same glossy finish, same croc embossing pattern, same brogue perforation, same lacing, same white welt stitching, same chunky lug sole, same proportions and camera angle.'\nPHYS='The shoes must sit believably on the surface with correct perspective and a grounded contact shadow under each shoe. Light direction and colour temperature must match the shading already on the product. Photorealistic commercial product photography, no text, no watermark.'\nfor S in wood street office autumn; do\n  case $S in\n    wood)   SCENE='on a weathered wooden floor beside a window, soft late-afternoon side light, blurred indoor background' ;;\n    street) SCENE='on wet grey cobblestones after rain, reflections in the puddles, overcast diffused light' ;;\n    office) SCENE='on a dark polished stone floor in a modern office lobby, cool directional light, glass panels blurred behind' ;;\n    autumn) SCENE='on a wooden deck with a few dry maple leaves, warm golden-hour side light' ;;\n  esac\n  dlazy gpt-image-2 \\\n    --prompt \"Place this product into a photorealistic lifestyle scene. $KEEP Replace the plain background with a scene: $SCENE. $PHYS\" \\\n    --images \"$SRC\" --size 1024x1024 --quality high --imageFormat jpeg \\\n    --bat"},{"language":"text","snippet":"Place this product into a photorealistic lifestyle scene.\n\nKeep the [商品品类 + 颜色 + 材质] 100% faithful: same [外形], same [材质光泽],\nsame [五金/缝线/纹理], same [logo 位置], same proportions and camera angle.\n\nReplace the background with [场景描述：表面 + 环境 + 道具 + 光线].\n\nThe product must sit believably on the surface with correct perspective and a\ngrounded contact shadow. Light direction and colour temperature must match the\nshading already on the product. [环境元素] subtly reflected on the [材质].\n\nPhotorealistic commercial product photography, no text, no watermark."},{"language":"bash","snippet":"dlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: item-change-background\nversion: 1.0.19\ndescription: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。\n---\n\n# item-change-background — 商品图生成逼真场景图\n\n白底商品图 → **有质感的实拍场景图**。商品不动，环境换掉。\n\n关键不是「贴一张背景」，而是**接地投影、环境反光、光向一致**——这三件事做不到，商品就像浮在背景上的贴纸。\n\n---\n\n## 生成效果示例\n\n| 输入：商品图 |\n| --- |\n| <img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/product-shoes.jpg\" width=\"280\"> |\n| `product-shoes.jpg` — 黑色鳄鱼纹亮面皮革布洛克德比鞋，白底，800×800 |\n\n实际执行的命令：\n\n```bash\ndlazy gpt-image-2 \\\n  --prompt 'Place this product into a photorealistic lifestyle scene. Keep the pair of black patent leather derby shoes 100% faithful: same glossy patent finish, same brogue perforation pattern, same lacing, same chunky lug sole, same proportions and camera angle. Replace the plain background with a warm autumn scene: a weathered wooden floor beside a window, a few dry maple leaves, soft late-afternoon side light casting a natural contact shadow under each shoe, blurred indoor background. The shoes must sit believably on the surface with correct perspective and grounded shadows. Photorealistic commercial product photography, no text, no watermark.' \\\n  --images docs/item-change-background/product-shoes.jpg \\\n  --size 1024x1024 --quality medium --imageFormat jpeg \\\n  --save docs/item-change-background/example-output.jpg\n```\n\n**输出**\n\n<img src=\"https://raw.githubusercontent.com/dlazy-ai/ecommerce-skills/main/docs/item-change-background/example-output.jpg\" width=\"320\">\n\n`example-output.jpg` — 1024×1024。鞋的鳄鱼纹压花、雕花孔、白色沿条明线与厚齿底保持不变；背景换成窗边旧木板 + 枫叶，午后侧光在鞋头形成高光，每只鞋下都有接地投影，木纹的暖色被亮面皮革轻微反射。\n\n---\n\n## 1、能力边界\n\n| 方式 | 说明 |\n| --- | --- |\n| 文生背景 | 用文字描述目标场景，模型生成环境 |\n| 上传背景 | 提供一张背景图，商品合成进去 |\n\n| 能力 | 说明 |\n| --- | --- |\n| 背景模板 | 智能推荐 / 木棍衣杆 / 浅色木枝 / 自定义 |\n| 商品类目 | 辅助判断合理场景（鞋 → 地面，美妆 → 台面，家居 → 房间） |\n| 物理正确 | 接地投影、环境反光、光向与色温一致 |\n\n**不做**：不改商品的外形、颜色、材质与 logo；不添加原图没有的商品部件；不生成误导性的使用场景（如非防水产品放进水里）。\n\n---\n\n## 2、输入素材规则\n\n生成前先自检这几条硬性约束：\n\n- 大小：**20KB ~ 15MB**\n- 分辨率：**大于 400×400**\n- 格式：**jpg / jpeg / png / webp**\n\n**输入建议**\n\n| 做法 | 说明 |\n| --- | --- |\n| ✅ 纯白/纯色底商品图 | 抠图边界最干净 |\n| ✅ 商品完整、主视角 | 出画的部分放进场景后要靠编 |\n| ✅ 光线均匀 | 原图有强方向光时，新场景的光向必须跟它一致 |\n| ❌ 已在复杂场景里 | 先用 [clothing-extraction](https://github.com/dlazy-ai/ecommerce-skills/blob/main/skills/clothing-extraction/skill.md) 或抠图洗成白底 |\n| ❌ 半透明/反光商品无参照 | 玻璃瓶、镜面商品要靠环境反光才真实，白底图信息不足 |\n\n---\n\n## 3、让商品「落地」的三条物理约束\n\n这三句几乎决定成败，每次都要写：\n\n```text\n1. 接地：sitting believably on the surface with correct perspective and a grounded contact shadow\n2. 光向：light direction and colour temperature must match the shading already on the product\n3. 反光：[环境元素] subtly reflected on the [商品材质], consistent with the scene\n```\n\n**类目 → 合理场景对照**\n\n| 类目 | 合理场景 | 忌 |\n| --- | --- | --- |\n| 鞋 | 木地板 / 石板路 / 台阶，商品接地 | 悬浮、放在布面上没有压痕 |\n| 包 | 椅背 / 桌面 / 手提，带受力形变 | 硬挺立在半空 |\n| 美妆 | 大理石台面 / 丝绒布 / 浴室台，带倒影 | 放在草地、户外 |\n| 3C | 木桌 / 办公桌 / 深色台面，硬光勾边 | 温馨田园风 |\n| 家居 | 完整房间透视，与家具比例合理 | 尺寸明显不对的房间 |\n| 食品 | 餐桌 / 厨房台面 / 竹垫，暖光 | 冷调工业风 |\n\n---\n\n## 4、工具调用\n\n本技能使用 dLazy 的 **`gpt-image-2`**（图像编辑模"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7c5wgeajfcfvdfb5ceemvdb984cjpd\",\n  \"slug\": \"item-change-background\",\n  \"version\": \"1.0.19\",\n  \"publishedAt\": 1791597078661\n}"},{"path":"references/model-flags.md","content":"# `gpt-image-2` 参数清单\r\n\r\n本技能默认用的模型的完整参数。日常只需要「参数约定」里那几个，\r\n这份清单在需要用到非常规参数时再看。\r\n\r\n**CRITICAL INSTRUCTION FOR AGENT**:\r\nRun the `dlazy gpt-image-2` command to get results.\r\n\r\n```bash\r\ndlazy gpt-image-2 -h\r\n\r\nOptions:\r\n  --prompt <prompt>            Prompt\r\n  --images [images...]         Images [image: url or local path] (max 5)\r\n  --size <size>                Size [default: auto] (choices: \"1024x1024\",\r\n                               \"1536x1024\", \"1024x1536\", \"2048x2048\",\r\n                               \"2048x1152\", \"3840x2160\", \"2160x3840\", \"auto\")\r\n  --imageFormat <imageFormat>  Image Format [default: jpeg] (choices: \"jpeg\",\r\n                               \"png\", \"webp\")\r\n  --quality <quality>          Quality [default: medium] (choices: \"low\",\r\n                               \"medium\", \"high\")\r\n  --dry-run                    Print payload without executing the tool\r\n  --no-wait                    Return generateId immediately for async tasks\r\n  --timeout <seconds>          Max seconds to wait for async completion\r\n                               (default: \"1800\")\r\n  --input <jsonOrFile>         Inline JSON or @path/to/file.json — merged under\r\n                               flag values (flags win)\r\n  --save <path>                Download the result asset to this local path\r\n                               (mkdir + retry handled for you). A destination\r\n                               path — NOT a response format; for stdout shape\r\n                               use --format\r\n  --batch <n>                  Fan-out N parallel runs (cloud tools only)\r\n                               (default: \"1\")\r\n  -h, --help                   display help for command\r\n```\r\n\r\n> Any flag also accepts pipe references — `-` (auto-pick from upstream stdin), `@N` (n-th output), `@N.path` (jsonpath into output), `@*` (all primary values), `@stdin` / `@stdin:path` (whole envelope). See `dlazy --help` for details.\r\n\r\n---\r\n\r\n换其他后端时参数由 `scripts/gen.mjs` 统一翻译，见 [`provider-cli.md`](provider-cli.md)。"},{"path":"references/provider-cli.md","content":"<!-- 由 scripts/build-skills.mjs 从 shared/references/provider-cli.md 同步生成，不要直接改这里。 -->\n# 后端调用参考\n\n技能正文只写「要生成什么」。认证、计费、错误码、输出结构这些每个技能都一样的东西放在这里，\n**用到时再读**，不占技能的常驻上下文。\n\n---\n\n## 一、认证\n\n### 默认后端 dLazy\n\n```bash\ndlazy login            # 设备码流程，远程 shell 也能用，自动写入本地配置\ndlazy auth set <KEY>   # 已有 key 时直接写入\n```\n\nkey 存在用户配置目录（macOS/Linux `~/.dlazy/config.json`，Windows `%USERPROFILE%\\.dlazy\\config.json`），\n权限限本机用户。也可以每次调用用环境变量 `DLAZY_API_KEY` 传入。\n\n手动获取：登录 [dlazy.com](https://dlazy.com) → [API Key 页面](https://dlazy.com/dashboard/organization/api-key)。\nkey 按组织隔离，可随时轮换或吊销。\n\n### 其他后端\n\n本技能库不锁定单一厂商。配好任意一家的 key 即可跑：\n\n| 后端 | 环境变量 | 说明 |\n| --- | --- | --- |\n| `dlazy` | `dlazy login` 或 `DLAZY_API_KEY` | 默认，最省事 |\n| `openai` | `OPENAI_API_KEY` | 走 `/v1/images/edits` 与 `/v1/images/generations` |\n| `gemini` | `GEMINI_API_KEY` | Nano Banana 系列 |\n| `fal` | `FAL_KEY` | |\n| `replicate` | `REPLICATE_API_TOKEN` | |\n| `ark` | `ARK_API_KEY` + `ARK_MODEL` | 火山方舟，模型 ID 需按开通情况填 |\n\n选路优先级：`--provider` 参数 > `PROVIDER` 环境变量 > 第一个配了 key 的 > `dlazy`。\n\n```bash\nnode scripts/gen.mjs --doctor     # 看当前哪个后端可用\n```\n\n各后端的模型 ID 可用 `GEN_MODEL_OPENAI` / `GEN_MODEL_GEMINI` / `GEN_MODEL_FAL` /\n`GEN_MODEL_REPLICATE` / `GEN_MODEL_ARK` 覆盖。**厂商目录会变，以各家最新文档为准。**\n\n---\n\n## 二、两种调用方式\n\n### 方式 A：统一入口（推荐）\n\n```bash\nnode scripts/gen.mjs --task <技能名> --prompt '...' --images a.jpg b.jpg --save out.jpg\n```\n\n它负责：后端选路、默认尺寸档位、失败重试（429/5xx 指数退避）、落盘建目录、成本估算。\n\n```bash\nnode scripts/gen.mjs --task flat-lay --prompt '...' --dry-run   # 不调用不计费，只看要发什么\nnode scripts/gen.mjs --help\n```\n\n### 方式 B：直接用 dLazy CLI\n\n不想引入 Node 依赖时，技能正文里的 `dlazy ...` 命令可以原样执行，效果等价。\n\n```bash\nnpx @dlazy/cli@1.2.3 <command>     # 不装全局二进制\n```\n\n- CLI 源码：[github.com/dlazy-ai/cli](https://github.com/dlazy-ai/cli) · npm 包 `@dlazy/cli`\n\n---\n\n## 三、数据流向\n\n调用 dLazy 时：提示词与参数发往 `api.dlazy.com`；传入的本地图片会上传到 `files.dlazy.com`\n供模型读取；产出 URL 同样托管在 `files.dlazy.com`。这是云端生成 API 的通用形态。\n换成其他后端时，数据流向对应厂商，不经过 dLazy。\n\n---\n\n## 四、输出结构\n\n`gen.mjs`（加 `--json`）：\n\n```json\n{\n  \"ok\": true,\n  \"task\": \"flat-lay\",\n  \"provider\": \"dlazy\",\n  \"model\": \"gpt-image-2\",\n  \"files\": [\"docs/flat-lay/output-sku001.jpg\"],\n  \"texts\": [],\n  \"estimatedCredits\": 60,\n  \"elapsedMs\": 58213\n}\n```\n\ndLazy CLI 原生：\n\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"tool\": \"gpt-image-2\",\n    \"data\": { \"urls\": [\"https://files.dlazy.com/data/ai/....jpg\"] },\n    \"savedPath\": \"docs/flat-lay/example-output.jpg\"\n  }\n}\n```\n\n加 `--no-wait` 的异步任务不返回 `data`，返回 `task: { generateId, status }`，\n用 `dlazy status <generateId> --wait` 轮询。\n\n文本类模型（如质检）产出在 `result.data.texts[0]`：\n\n```bash\ndlazy claude-sonnet-5 --prompt '...' --images x.jpg \\\n  | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"result\"][\"data\"][\"texts\"][0])'\n```\n\n---\n\n## 五、错误处理\n\n| Code | 类型 | 示例 |\n| --- | --- | --- |\n| 401 | 未授权 / 无 key | `ok: false, code: \"unauthorized\"` |\n| 501 | 缺必填参数 | `error: required option '--prompt <prompt>' not specified` |\n| 502 | 本地文件读不到 | `Error: Image file not found: ...` |\n| 503 | 余额不足 | `ok: false, code: \"insufficient_balance\"` |\n| 503 | 服务端错误 | `HTT"},{"path":"scripts/lib/tasks.json","content":"{\r\n  \"_note\": \"技能 → 默认模型与参数。dlazy 列为默认后端的模型名；其他后端走 providers.mjs 的通用映射，可用 GEN_MODEL_<PROVIDER> 覆盖。\",\r\n  \"_credits\": { \"gpt-image-2\": 60, \"seedream-5.0\": 30, \"seedream-5.0-pro\": 45, \"banana-pro\": 25, \"claude-sonnet-5\": 3 },\r\n  \"tasks\": {\r\n    \"flat-lay\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"wear-everything\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"image-fusion\":            { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"one-shot\":                { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"fission-pattern\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-detail\":             { \"model\": \"seedream-5.0-pro\", \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"creative-scene\":          { \"model\": \"banana-pro\",       \"size\": \"1024x1536\", \"format\": \"jpeg\" },\r\n    \"batch-image\":             { \"model\": \"seedream-5.0\",     \"size\": \"3:4\",       \"resolution\": \"2k\" },\r\n    \"to-3d\":                   { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-extraction\":     { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"fabric-on-body\":          { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-detail\":         { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"clothing-grass-planting\": { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"medium\", \"format\": \"jpeg\" },\r\n    \"item-selling-point\":      { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"item-change-background\":  { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"remove-watermark\":        { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"material-enhancement\":    { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"item-repair\":             { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"detect-task\":             { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"listing-optimizer\":       { \"model\": \"gpt-image-2\",      \"size\": \"1024x1024\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"cross-border-localize\":   { \"model\": \"seedream-5.0-pro\", \"size\": \"1:1\",       \"resolution\": \"2k\" },\r\n    \"brand-kit\":               { \"model\": \"gpt-image-2\",      \"size\": \"1024x1536\", \"quality\": \"high\",   \"format\": \"jpeg\" },\r\n    \"platform-compliance\":     { \"model\": \"claude-sonnet-5\",  \"text\": true },\r\n    \"main-image-video\":        { \"model\": \"$DLAZY_VIDEO_MODEL\", \"video\": true },\r\n    \"product-"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。 Skill: 商品换背景 Item Change Background Owner: dlazyai Summary: 商品换背景。白底商品图 → 逼真场景图，光影与投影匹配新环境。当用户说「换背景」「加场景」「白底转场景」「放到桌面上」时使用。 Tags: latest:1.0.19 Version history: v1.0.19 | 2026-10-10T01:51:18.661Z | user 例行版本更新 2026-10-10 v1.0.18 | 2026-10-08T01:43:55.300Z | user 例行版本更新 2026-10-08 v1.0.17 | 2026-10-04T01:43:54.013Z | user 例行版本更新 2026-10-04 v1.0.16 | 2026-10-02T05:16:32.193Z | user 例行版本更新 2026-10-02 v1.0.15 | 2026-09-3","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":979,"uniquenessScore":50,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T20:46:43.719Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T20:46:43.719Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T23:47:01.514Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}