| .agents/skills | ||
| docs | ||
| static | ||
| tests | ||
| .gitignore | ||
| AGENTS.md | ||
| app.py | ||
| cleaner.py | ||
| CONTEXT.md | ||
| gemini-only.yml | ||
| mise.toml | ||
| pytest.ini | ||
| README.md | ||
| requirements.txt | ||
| skills-lock.json | ||
| unwrap_clothes.py | ||
Garment photo cleaner
CLI tool that cleans up second-hand clothing photos for marketplace listings (Vinted, eBay, Depop). It removes fabric wrinkles, puts the garment on a studio backdrop (warm beige or bright white), and preserves shapes, colors, prints, buttons, and defects.
Uses OpenRouter's Image API with meta/muse-image.
Requirements
- Python 3.9 or higher
- OpenRouter API key with image generation credits
Install dependencies:
pip install -r requirements.txt
Set your API key:
export OPENROUTER_API_KEY="sk-or-v1-..."
Usage
Basic run with default soft beige background:
python3 unwrap_clothes.py shirt.jpg
Output saves next to the source photo as shirt_clean.jpg.
Options
Select a white background:
python3 unwrap_clothes.py shirt.jpg --bg white
Custom output path:
python3 unwrap_clothes.py shirt.jpg -o /path/to/listing_photo.jpg
Custom background description:
python3 unwrap_clothes.py shirt.jpg --bg "Soft cool grey studio background, even lighting"
Keep native model resolution (skip automatic upscale to input dimensions):
python3 unwrap_clothes.py shirt.jpg --no-restore-res
Override the model:
python3 unwrap_clothes.py shirt.jpg --model meta/muse-image
Why meta/muse-image is the default
Other image models on OpenRouter run into policy or cost issues on second-hand clothing photos:
openai/gpt-5-image-mini: OpenAI's input image filter rejects photos with licensed character artwork (such as Winnie the Pooh, Disney, or cartoon prints), returning HTTP 400 safety errors regardless of prompt phrasing.qwen/qwen-image-3: Alibaba moderation frequently blocks full garment photos, and Qwen 3 Pro costs roughly $0.08 per image.meta/muse-image: Accepts photos of branded and character clothing, costs $0.01 per image, and finishes in 15 to 25 seconds.
Resolution handling
meta/muse-image caps output at roughly 1.3 to 1.8 MP (for example, 1376x1824) regardless of the size parameters passed to the API.
To avoid downsized uploads on marketplaces that expect high-resolution smartphone photos (such as 3024x4032), the script automatically resizes the generated image back to the source file's exact dimensions using Lanczos interpolation. This preserves the aspect ratio and frame size of the original photo.
Known limitations
- Garments that are physically folded or bunched over themselves in the photo remain bunched. Generative editing smooths surface wrinkles, but will not unfold fabric that covers other parts of the garment.
- Small text on labels and complex repeating patterns can drift slightly from the original during generation.