amazon-listing-kit
<div align="center">
<h1>amazon-listing-kit</h1>
<p>Check RGB 255 & 85% fill, auto-fix main images, and render compliant listing sets locally.</p>
<p><strong>English</strong> · <a href="README.zh-CN.md">简体中文</a></p>
<p>
<img alt="Python 3.10+" src="https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square" />
<img alt="MIT License" src="https://img.shields.io/badge/License-MIT-22C55E?style=flat-square" />
<img alt="MCP Server" src="https://img.shields.io/badge/MCP-Server-412991?style=flat-square" />
<img alt="Agent Skill" src="https://img.shields.io/badge/Agent-Skill-D6B88D?style=flat-square" />
</p>
<img src="docs/assets/hero.jpg" alt="amazon-listing-kit showcase" width="100%" />
</div>
## Showcase Gallery
<table>
<tr>
<td align="center" valign="top" width="33%">
<img src="docs/assets/showcase-main.jpg" alt="MAIN — AURA S1 on a pure white background" width="100%" />
<br /><sub><b>MAIN</b></sub>
</td>
<td align="center" valign="top" width="33%">
<img src="docs/assets/showcase-portrait.jpg" alt="Editorial portrait — golden-hour model wearing AURA S1" width="100%" />
<br /><sub><b>Editorial Portrait</b></sub>
</td>
<td align="center" valign="top" width="33%">
<img src="docs/assets/showcase-infographic.jpg" alt="PT01 — key features: 45dB ANC and 60h battery" width="100%" />
<br /><sub><b>PT01 Infographic</b></sub>
</td>
</tr>
<tr>
<td align="center" valign="top" width="33%">
<img src="docs/assets/showcase-detail.jpg" alt="PT04 — detail macro of brushed titanium and stitched lambskin" width="100%" />
<br /><sub><b>PT04 Detail</b></sub>
</td>
<td align="center" valign="top" width="33%">
<img src="docs/assets/showcase-lifestyle.jpg" alt="Editorial lifestyle — sunlit cafe portrait" width="100%" />
<br /><sub><b>Editorial Lifestyle</b></sub>
</td>
<td align="center" valign="top" width="33%">
<img src="docs/assets/showcase-fit.jpg" alt="PT03 — fit and comfort: 258g featherweight titanium" width="100%" />
<br /><sub><b>PT03 Fit & Comfort</b></sub>
</td>
</tr>
</table>
<p align="center"><sub>The AURA S1 sample set was generated with Eluvana (<a href="https://app.eluvana.com">app.eluvana.com</a>). amazon-listing-kit handles local compliance checking, main-image fixing, ONNX cutout, and programmatic slot rendering — no LLM API key required. The MAIN frame above is a real <code>check_main_image</code> pass: 2000×2000, 92% fill, 100% pure white (RGB 255, 255, 255), 6 of 6 checks.</sub></p>
## Highlights
- **Checker** — six Amazon main-image rules: resolution, square ratio, format / 10 MB, pure white **RGB 255, 255, 255**, **85%** product fill, and edges.
- **Fixer** — replace a light or off-white backdrop with RGB 255, reframe to a 2000×2000 canvas, and return a fresh report.
- **Studio** (optional extra) — inspect a source photo, cut the product out with a local ONNX model, and compose main, infographic, dimensions, detail, angle, in-box, and comparison images. Lifestyle shots are out of scope.
- **No cloud generation** — no generative-model API key, no database, no billing. Runs as an [Agent Skill](https://agentskills.io) plus an [MCP](https://modelcontextprotocol.io) server.
The Agent Skill at [`skills/amazon-listing-kit/SKILL.md`](skills/amazon-listing-kit/SKILL.md) is written for an operator agent: intake and fact-extraction (so typography slots are not invented), a four-marketplace compliance matrix, a 5-stage diagnose → cutout → repair → render → pre-upload workflow, and a troubleshooting playbook. Slot-by-slot copy budgets and buyer-objection layouts live in [`skills/amazon-listing-kit/references/amazon-slot-playbook.md`](skills/amazon-listing-kit/references/amazon-slot-playbook.md) and are loaded on demand.
## Install
### Agent Skill
```bash
npx skills add blockCloth/amazon-listing-kit
```
### MCP Server (checker + fixer)
```bash
uvx --from git+https://github.com/blockCloth/amazon-listing-kit amazon-listing-kit
```
With the studio extra (cutout + listing-set rendering):
```bash
uvx --from 'amazon-listing-kit[studio] @ git+https://github.com/blockCloth/amazon-listing-kit' amazon-listing-kit
```
Or install from a local checkout:
```bash
pip install -e .
pip install -e '.[studio]' # cutout + listing set
```
Python 3.10+ is required. Base dependencies are `fastmcp`, `pillow`, and `pydantic`. The `[studio]` extra adds `numpy` and `onnxruntime`.
### MCP client config
Add the server to your MCP client (Claude Desktop, Cursor, …):
```json
{
"mcpServers": {
"amazon-listing-kit": {
"command": "uvx",
"args": [
"--from",
"amazon-listing-kit[studio] @ git+https://github.com/blockCloth/amazon-listing-kit",
"amazon-listing-kit"
]
}
}
}
```
Drop the `[studio]` extra from the `--from` argument if you only need `check_main_image` and `fix_main_image`.
## MCP Tools
| Tool | Extra | What it does |
|---|---|---|
| `check_main_image(image_path, platform="amazon")` | base | Six-check Amazon main-image report (`pass` / `warn` / `fail`). |
| `fix_main_image(image_path, output_path, size=2000, target_fill=0.88)` | base | Whiten the backdrop, reframe to a square canvas, re-check. |
| `inspect_and_cutout(image_path, output_path=None, model="isnet")` | `[studio]` | Inspect resolution / blur / crop and write an RGBA cutout via ISNet or BiRefNet. |
| `render_listing_set(cutout_path, output_dir, product_name, prefix="ASIN", slots=None, facts=None, platform="amazon")` | `[studio]` | Render the listing set as `{prefix}.{code}.jpg` (or the platform's naming convention). No LLM key. |
Calling a studio tool without the extra raises `ImportError` and tells you to install `amazon-listing-kit[studio]`.
## Python Quickstart
```python
from amazon_listing_kit.check import check_main_image
from amazon_listing_kit.fix import fix_main_image
report = check_main_image("mug.jpg")
print(report["status"], report["checks"])
fixed = fix_main_image("mug.jpg", "mug.MAIN.jpg", size=2000)
print(fixed["check"]["status"], fixed["output_path"])
```
Studio (needs `amazon-listing-kit[studio]`):
```python
from amazon_listing_kit.studio.listing import inspect_and_cutout, render_listing_set
cut = inspect_and_cutout("mug.jpg", "mug-cutout.png", model="isnet")
result = render_listing_set(
cut["output_path"],
"out/",
product_name="Sunrise Mug",
prefix="B0EXAMPLE",
facts={
"sellingPoints": [
{"title": "Hand-glazed ceramic", "detail": "Unique glaze on every mug"},
{"title": "12 oz capacity", "detail": "Comfortable everyday size"},
],
"dimensions": {"width": 4.7, "height": 3.3, "length": 3.5, "unit": "in"},
"inBox": [{"label": "Ceramic mug", "quantity": 1}],
"comparison": {
"rows": [
{"feature": "Hand-glazed finish", "ours": True, "others": False},
]
},
},
)
print(result["files"])
```
`render_listing_set` can also take a ready-made RGBA cutout, so you can skip ONNX if you already have a transparent PNG.
## Supported Marketplaces
| | Amazon MAIN | Shopify | Etsy | eBay |
|---|---|---|---|---|
| Recommended canvas | **2000×2000** | **2048×2048**, consistent framing across the catalogue | **2000 px** on the shortest side; this kit uses **2000×2500** | **1600×1600** (longest side) |
| Hard floor | **1000 px** longest side (zoom) | — | — | **500 px** longest side |
| Background | Pure white **RGB 255, 255, 255** | Any, keep it consistent | Context is welcome; white not required | Plain light preferred, not required |
| Product fill | ≥ **85%** of the frame (fixer targets 0.88) | Keep fill consistent | Compose for the **4:5** search crop — keep the product inside the vertical centre | Not mandated |
| Format / size cap | JPEG, PNG, TIFF, GIF / **10 MB** | JPEG, PNG, WebP, HEIC, GIF / 20 MB | JPEG, PNG, GIF / 20 MB | JPEG, PNG, TIFF, BMP, GIF / **12 MB** |
| File names | `{prefix}.{code}.jpg` (`MAIN`, `PT01`, `PT03`, `PT04`, `PT05`, `PT07`, `PT08`) | `{prefix}-{index}.jpg` | `{prefix}-{index}.jpg` | `{prefix}-{index}.jpg` |
Amazon files are named `{prefix}.{code}.jpg`. Shopify uses `{prefix}-{index}.jpg` on a 2048×2048 canvas. Etsy uses a 2000×2500 (4:5) canvas. eBay uses 1600×1600 and a 12 MB cap.
## Model Cache & Fonts
The first `inspect_and_cutout` run downloads an Apache-2.0 ISNet (~180 MB) or MIT BiRefNet (~220 MB) model into `~/.cache/amazon-listing-kit/models/`. Set `AMAZON_LISTING_KIT_MODEL_DIR` to override the cache, or `AMAZON_LISTING_KIT_AUTO_DOWNLOAD=0` to disable downloads.
Inter Variable (SIL Open Font License) is bundled and used for typography. Noto Sans SC is downloaded from the official [`notofonts/noto-cjk`](https://github.com/notofonts/noto-cjk) repository on first CJK use into `~/.cache/amazon-listing-kit/fonts/`. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
## License
[MIT](LICENSE).
TDQS
Scored across 4 tools
The four tools map to distinct stages: check (read-only validation), fix (write/repair), cutout (extraction), and render (set generation). The only mild overlap is that fix_main_image also returns a compliance report, which could tempt an agent to use it instead of check_main_image for validation, but the write-vs-read distinction is clear.
All names use snake_case and begin with a verb, making them predictable. inspect_and_cutout bundles two actions into one name, a minor inconsistency compared to the single verb_noun pattern of the others, but overall readable.
Four tools is well-scoped for an image-preparation kit; each tool covers a necessary step (check, fix, cutout, render) with no redundant entries. The count sits comfortably in the recommended range.
The surface covers the core image lifecycle: validation, repair, cutout extraction, and multi-slot rendering. Gaps include no tool for lifestyle image generation (acknowledged as out of scope) and no batch or multi-image validation, but these are minor for the stated purpose.