基于 Pillow 的图像处理工具:缩放、裁剪、水印、格式转换与 Web 优化一次搞定。
设计与多媒体
Bria Ai
试用通过 20+ 个 Bria.ai 接口生成、编辑和处理可商用的图片。
它能做什么
封装 Bria.ai 图片 API,支持文生图、自然语言编辑、抠图与背景替换、商品场景图以及图片放大。认证走 OAuth 设备流,凭据缓存在 ~/.bria/credentials。覆盖 20+ 个接口,涵盖生成、编辑、风格化、重打光、上色、修复、扩图等能力。
什么时候用它
- 为商品图抠出透明 PNG
- 根据文字描述生成 Banner 或头图
- 把商品放进家居或生活场景做电商主图
- 放大或重新风格化已有图片
技能文档
Bria — AI Image Generation, Editing & Background Removal
Commercially safe, royalty-free image generation and editing through 20+ API endpoints.
For additional endpoint details, see the Bria API reference for agents.
When to Use This Skill
- Generate images — "create an image of...", "make me a banner", "generate a hero image", "I need a product photo"
- Edit images — "change the background", "make it look like winter", "add a vase to the table", "remove the person"
- Remove/replace backgrounds — "make the background transparent", "cut out the product", "replace with a studio background"
- Product photography — "create a lifestyle shot", "place this product in a kitchen scene", "e-commerce packshot"
- Enhance/transform — "upscale this image", "make it higher resolution", "restyle as oil painting", "change the lighting"
Setup — Authentication
Step 1: Check for existing credentials
if [ -f ~/.bria/credentials ]; then
BRIA_ACCESS_TOKEN=$(grep '^access_token=' "$HOME/.bria/credentials" | cut -d= -f2-)
BRIA_API_KEY=$(grep '^api_token=' "$HOME/.bria/credentials" | cut -d= -f2-)
fi
if [ -z "$BRIA_ACCESS_TOKEN" ]; then
echo "NO_CREDENTIALS"
elif [ -n "$BRIA_API_KEY" ]; then
echo "READY"
else
echo "CREDENTIALS_FOUND"
fi
READY→ skip to making API callsCREDENTIALS_FOUND→ skip to Step 3NO_CREDENTIALS→ proceed to Step 2
Step 2: Authenticate via device flow
Source the auth helper and run bria_auth:
source ~/.agents/skills/bria-ai/references/code-examples/bria_auth.sh
bria_auth
bria_auth will print SIGN_IN_URL=... and USER_CODE=.... Show the user exactly this — nothing more:
Connect your Bria account: Click here to sign in Your code is {USER_CODE} — it's already filled in.
Then wait; bria_auth polls automatically and prints AUTHENTICATED when done.
If it prints an error, the code expired — run bria_auth again.
Do not proceed with any API call until authentication is confirmed.
Step 3: Verify billing status and resolve API key
source ~/.agents/skills/bria-ai/references/code-examples/bria_auth.sh
bria_introspect
Interpret output:
BILLING_ERROR: ...— relay the message to the user verbatim and stop. Do not make any API calls.TOKEN_EXPIRED— tell the user their session expired and restart from Step 2.READY—BRIA_API_KEYis now cached in~/.bria/credentials. Proceed.
Decision Tree — Which Endpoint to Use
Transparent PNG / cutout / remove background?
→ /v2/image/edit/remove_background
Generate image from scratch (text → image)?
→ /v2/image/generate
Edit existing image with text instruction?
→ /v2/image/edit (use --key images)
Change / replace / blur background?
→ /v2/image/edit/replace_background (prompt: "blur" or describe new bg)
Place product in a lifestyle scene?
→ /v1/product/lifestyle_shot_by_text
Upscale / increase resolution?
→ /v2/image/edit/increase_resolution (scale: 2 or 4)
Anything else (restyle, relight, reseason, restore, colorize, sketch, blend, outpaint)?
→ See references/capabilities.md for the full endpoint list
How to Call Any Endpoint
source ~/.agents/skills/bria-ai/references/code-examples/bria_client.sh
# Generate (no image input)
RESULT=$(bria_call /v2/image/generate "" '"prompt": "your description", "aspect_ratio": "16:9", "sync": true')
# Remove background
RESULT=$(bria_call /v2/image/edit/remove_background "/path/to/local/image.png")
# Replace background
RESULT=$(bria_call /v2/image/edit/replace_background "https://example.com/img.jpg" '"prompt": "sunset beach"')
# Edit image (uses images array — pass --key images)
RESULT=$(bria_call /v2/image/edit "/path/to/image.png" --key images '"instruction": "make it look warmer"')
# Upscale
RESULT=$(bria_call /v2/image/edit/increase_resolution "https://example.com/img.jpg" '"scale": 4')
# Lifestyle shot
RESULT=$(bria_call /v1/product/lifestyle_shot_by_text "/path/to/product.png" '"scene_description": "modern kitchen countertop"')
echo "$RESULT"
Calling convention: bria_call [--key ] [extra JSON fields...]
- Pass a URL, local file path, or
""for endpoints without image input - Use
--key imageswhen the endpoint expects animagesarray instead ofimage - Returns the result image URL on success, or prints an error to stderr
Generation options: Aspect ratios 1:1, 16:9, 4:3, 9:16, 3:4. Resolution 1MP (default) or 4MP (more detail, +30s). Pass "sync": true for single images.
Advanced: For precise control over generation, use the vgl skill for structured VGL JSON prompts.
Common Failures
bria_callreturns empty / no URL →BRIA_API_KEYwas not set. Run Step 3 (bria_introspect) to cache it.- Async job times out → Some endpoints take 60–90s. If
bria_callreports a timeout, retry once; the job may have been queued. - ERROR 401 → API key is stale. Delete
~/.bria/credentialsand re-authenticate from Step 2. BILLING_ERROR→ Relay message to user verbatim, do not retry API calls.- Local file not found → Pass the absolute path;
bria_client.shhandles base64 encoding automatically. /v2/image/editreturns wrong result → Confirm--key imagesflag is present; this endpoint requires the images array format.
Resources
- Capabilities & Prompt Recipes — Full endpoint table, use-case recipes, and prompt engineering tips
- API Endpoints Reference — Complete parameter documentation for all 20+ endpoints
- Shell Client (bria_client.sh) —
bria_callhelper: auth, base64, JSON, polling - Auth Helper (bria_auth.sh) —
bria_authandbria_introspectfunctions - Full API docs for agents (llms.txt) — Agent-ready Bria API reference
Related Skills
- vgl — Structured VGL JSON prompts for precise, deterministic control over FIBO image generation
- image-utils — Classic image manipulation (resize, crop, composite, watermarks) for post-processing
常见问题
- 怎么登录认证?
- 运行 bria_auth 启动 OAuth 设备流,把登录链接和用户码交给用户;再调用 bria_introspect 把 API key 写入 ~/.bria/credentials,才能继续调用接口。
- 生成结果可以商用吗?
- 可以。文档明确说明 Bria 的图片输出为 commercially safe、免版税。
- 支持哪些接口?
- 20+ 个接口,包括 /v2/image/generate、/v2/image/edit、/v2/image/edit/remove_background、/v2/image/edit/replace_background、/v2/image/edit/increase_resolution、/v1/product/lifestyle_shot_by_text,以及 restyle、relight、restore、colorize、outpaint 等变体,完整列表见 references/capabilities.md。
相关技能
Create and refine images from a written brief, one to four ordered reference images, or an existing base image. Beatra AI Image Studio supports text-to-image generation, reference-guided composition, and focused AI image editing for product photos, ad creative, brand visuals, posters, social graphics, illustrations, concept art, and photo background changes. Review each generated image for message, subject fidelity, composition, style, text, and destination fit, then choose the smallest useful edit, new composition, or new generation.
Create and refine images from a written brief, one to four ordered reference images, or an existing base image. AI Image Generation Studio supports text-to-image generation, reference-guided composition, and focused AI image editing for product photos, ad creative, brand visuals, posters, social graphics, illustrations, concept art, and photo background changes. Review each generated image for message, subject fidelity, composition, style, text, and destination fit, then choose the smallest useful edit, new composition, or new generation.
Transform a real product photo into a studio-quality ecommerce image, lifestyle scene, or marketplace-ready hero shot. This AI product photography tool replaces backgrounds, improves lighting, and stages scenes while using the source photo and confirmed product details as the visual anchor. Create clean white-background listings, contextual lifestyle compositions, and premium ad visuals from a single phone snap for Amazon, Taobao, Shopify, and social media. Start from one product photo, combine several references, or refine a selected draft toward a polished listing image.
Generate images that read as real photographs, not AI renders: candid portraits, editorial, documentary, food, architectural, lifestyle. Use when the user sa...
通过文本或参考图生成与编辑图像,支持多模型路由、角色一致性以及电商产品图拍摄。