Get the FREE Ultimate OpenClaw Setup Guide →

bria-ai

npx machina-cli add skill Bria-AI/bria-skill/bria-ai --openclaw
Files (1)
SKILL.md
12.4 KB

Bria — Controllable Image Generation & Editing

Generate and precisely control visual assets using Bria's commercially-safe AI models (FIBO, RMBG-2.0, GenFill, and more). Unlike black-box generators, Bria gives you fine-grained control: edit by text instruction, mask specific regions, add/replace/remove individual objects, change lighting or season independently, and chain operations in pipelines.

Setup — API Key Check

Before making any Bria API call, check for the API key and help the user set it up if missing:

Step 1: Check if the key exists

echo $BRIA_API_KEY

If the output is not empty, skip to the next section.

Step 2: If the key is missing, guide the user

Open the Bria API keys page in the browser:

open "https://platform.bria.ai/console/account/api-keys?utm_source=skill&utm_campaign=bria_skills&utm_content=adjust_photoshop_for_agent"   # macOS
# xdg-open "https://platform.bria.ai/console/account/api-keys?utm_source=skill&utm_campaign=bria_skills&utm_content=adjust_photoshop_for_agent"  # Linux

Then tell the user exactly this:

I opened the Bria website in your browser. To use image generation, you need a free API key.

  1. Sign up or log in on the page I just opened
  2. Click Create API Key
  3. Copy the key and paste it here

Wait for the user to provide their API key. Do not proceed until they give you the key.

Step 3: Save the key permanently

Once the user provides the key, save it so it persists across sessions.

On macOS/Linux, detect the shell and append to the correct profile:

# Detect the shell profile
if [ -n "$ZSH_VERSION" ] || [ "$SHELL" = */zsh ]; then
  PROFILE_FILE="$HOME/.zshrc"
elif [ -f "$HOME/.bashrc" ]; then
  PROFILE_FILE="$HOME/.bashrc"
else
  PROFILE_FILE="$HOME/.profile"
fi

# Append the export (only if not already present)
grep -q 'export BRIA_API_KEY=' "$PROFILE_FILE" 2>/dev/null && \
  sed -i.bak '/export BRIA_API_KEY=/d' "$PROFILE_FILE"
echo 'export BRIA_API_KEY="THE_KEY_THE_USER_GAVE_YOU"' >> "$PROFILE_FILE"

# Make it available immediately in this session
export BRIA_API_KEY="THE_KEY_THE_USER_GAVE_YOU"

On Windows (PowerShell):

[System.Environment]::SetEnvironmentVariable("BRIA_API_KEY", "THE_KEY_THE_USER_GAVE_YOU", "User")
$env:BRIA_API_KEY = "THE_KEY_THE_USER_GAVE_YOU"

Replace THE_KEY_THE_USER_GAVE_YOU with the actual key the user provided.

Step 4: Verify

echo $BRIA_API_KEY

Confirm the key is set, then tell the user:

Your API key is saved and will persist across sessions. You're all set!

Do not proceed with any image generation or editing until the API key is confirmed set.


Core Capabilities

NeedCapabilityUse Case
Create new imagesFIBO GenerateHero images, product shots, illustrations
Edit by textFIBO-EditChange colors, modify objects, transform scenes
Edit with maskGenFill/ErasePrecise inpainting, add/replace specific regions
Add/Replace/Remove objectsText-based editingAdd vase, replace apple with pear, remove table
Transparent backgroundsRMBG-2.0Extract subjects for overlays, logos, cutouts
Background operationsReplace/Blur/EraseChange, blur, or remove backgrounds
Expand imagesOutpaintingExtend boundaries, change aspect ratios
Upscale imagesSuper ResolutionIncrease resolution 2x or 4x
Enhance qualityEnhancementImprove lighting, colors, details
Transform styleRestyleOil painting, anime, cartoon, 3D render
Change lightingRelightGolden hour, spotlight, dramatic lighting
Change seasonReseasonSpring, summer, autumn, winter
Blend/compositeImage BlendingApply textures, logos, merge images
Restore photosRestorationFix old/damaged photos
ColorizeColorizationAdd color to B&W, or convert to B&W
Sketch to photoSketch2ImageConvert drawings to realistic photos
Product photographyLifestyle ShotPlace products in scenes
Product integrationProduct IntegrateEmbed products into scenes at exact coordinates

Quick Reference

Generate an Image (FIBO)

curl -X POST "https://engine.prod.bria-api.com/v2/image/generate" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "your description",
    "aspect_ratio": "16:9",
    "resolution": "1MP"
  }'

Aspect ratios: 1:1 (square), 16:9 (hero/banner), 4:3 (presentation), 9:16 (mobile/story), 3:4 (portrait)

Resolution: 1MP (default) or 4MP (improved details for photorealism, adds ~30s latency)

Advanced: For precise, deterministic control over generation, use VGL structured prompts instead of natural language. VGL defines every visual attribute (objects, lighting, composition) as explicit JSON.

Remove Background (RMBG-2.0)

curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/remove_background" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "https://..."}'

Returns PNG with transparency.

Edit Image (FIBO-Edit) - No Mask Required

curl -X POST "https://engine.prod.bria-api.com/v2/image/edit" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "images": ["https://..."],
    "instruction": "change the mug to red"
  }'

Edit Image Region with Mask (GenFill)

curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/gen_fill" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://...",
    "mask": "https://...",
    "prompt": "what to generate in masked area"
  }'

Expand Image (Outpainting)

curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/expand" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "base64-or-url",
    "aspect_ratio": "16:9",
    "prompt": "coffee shop background, wooden table"
  }'

Upscale Image

curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/increase_resolution" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "https://...", "scale": 2}'

Product Lifestyle Shot

curl -X POST "https://engine.prod.bria-api.com/v1/product/lifestyle_shot_by_text" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://product-with-transparent-bg.png",
    "prompt": "modern kitchen countertop, natural morning light"
  }'

Integrate Products into Scene

Place one or more products at exact coordinates in a scene. Products are automatically cut out and matched to the scene's lighting and perspective.

curl -X POST "https://engine.prod.bria-api.com/image/edit/product/integrate" \
  -H "api_token: $BRIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scene": "https://scene-image-url",
    "products": [
      {
        "image": "https://product-image-url",
        "coordinates": {"x": 100, "y": 200, "width": 300, "height": 400}
      }
    ]
  }'

Async Response Handling

All endpoints return async responses:

{
  "request_id": "uuid",
  "status_url": "https://engine.prod.bria-api.com/v2/status/uuid"
}

Poll the status_url until status: "COMPLETED", then get result.image_url.

import requests, time

def get_result(status_url, api_key):
    while True:
        r = requests.get(status_url, headers={"api_token": api_key})
        data = r.json()
        if data["status"] == "COMPLETED":
            return data["result"]["image_url"]
        if data["status"] == "FAILED":
            raise Exception(data.get("error"))
        time.sleep(2)

Prompt Engineering Tips

  • Style: "professional product photography" vs "casual snapshot", "flat design illustration" vs "3D rendered"
  • Lighting: "soft natural light", "studio lighting", "dramatic shadows"
  • Background: "white studio", "gradient", "blurred office", "transparent"
  • Composition: "centered", "rule of thirds", "negative space on left for text"
  • Quality keywords: "high quality", "professional", "commercial grade", "4K", "sharp focus"
  • Negative prompts: "blurry, low quality, pixelated", "text, watermark, logo"

API Reference

See references/api-endpoints.md for complete endpoint documentation.

Key Endpoints

Generation

EndpointPurpose
POST /v2/image/generateGenerate images from text (FIBO)

Edit by Text (No Mask)

EndpointPurpose
POST /v2/image/editEdit image with natural language instruction
POST /v2/image/edit/add_object_by_textAdd objects to image
POST /v2/image/edit/replace_object_by_textReplace objects in image
POST /v2/image/edit/erase_by_textRemove objects by name

Edit with Mask

EndpointPurpose
POST /v2/image/edit/gen_fillInpaint/generate in masked region
POST /v2/image/edit/eraseErase masked region

Background Operations

EndpointPurpose
POST /v2/image/edit/remove_backgroundRemove background (RMBG-2.0)
POST /v2/image/edit/replace_backgroundReplace with AI-generated background
POST /v2/image/edit/blur_backgroundApply blur to background
POST /v2/image/edit/erase_foregroundRemove foreground, fill background
POST /v2/image/edit/crop_foregroundCrop tightly around subject

Image Transformation

EndpointPurpose
POST /v2/image/edit/expandOutpaint to new aspect ratio
POST /v2/image/edit/enhanceEnhance quality and details
POST /v2/image/edit/increase_resolutionUpscale 2x or 4x
POST /v2/image/edit/blendBlend/merge images or textures
POST /v2/image/edit/reseasonChange season/weather
POST /v2/image/edit/restyleTransform artistic style
POST /v2/image/edit/relightModify lighting

Restoration

EndpointPurpose
POST /v2/image/edit/sketch_to_colored_imageConvert sketch to photo
POST /v2/image/edit/restoreRestore old/damaged photos
POST /v2/image/edit/colorizeColorize B&W or convert to B&W

Product Photography

EndpointPurpose
POST /v1/product/lifestyle_shot_by_textPlace product in scene by text
POST /image/edit/product/integrateIntegrate products into scene at exact coordinates

Utilities

EndpointPurpose
POST /v2/structured_instruction/generateGenerate JSON instruction (no image)
GET /v2/status/{id}Check async request status

Authentication

All requests need api_token header:

api_token: YOUR_BRIA_API_KEY

Additional Resources

Related Skills

  • vgl — Write structured VGL JSON prompts for precise, deterministic control over FIBO image generation
  • image-utils — Classic image manipulation (resize, crop, composite, watermarks) for post-processing

Source

git clone https://github.com/Bria-AI/bria-skill/blob/main/skills/bria-ai/SKILL.mdView on GitHub

Overview

Bria.ai provides controllable image generation and editing using commercially-safe AI models. You can edit by text, mask regions, and add/replace/remove objects while independently adjusting lighting, season, and style. It's ideal for producing product photos, hero images, icons, illustrations, backgrounds, and scalable assets for websites, apps, presentations, or documents, as well as for batch generation and pipeline workflows.

How This Skill Works

Bria exposes API-based access to generation, editing, and inpainting with models like FIBO Generate, FIBO-Edit, and GenFill/Erase. You create assets by prompting generation, then apply precise edits via text instructions or masks, including adding/removing objects and region-specific changes. You can chain steps (generate -> edit -> remove background) to build production-ready visuals with independent controls for lighting, season, and style.

When to Use It

  • Creating hero images, product photos, icons, or illustrations for websites and apps
  • Removing backgrounds or isolating subjects for marketing assets
  • Editing specific areas with masks or text prompts to change colors, objects, or layouts
  • Applying style transfer, lighting, or seasonal adjustments independently for consistency
  • Running batch generation and pipeline workflows (generate → edit → remove background) for large asset sets

Quick Start

  1. Step 1: Define your target asset by outlining prompts, regions to mask, and objects to add/replace/remove
  2. Step 2: Generate images using Bria's FIBO Generate and review results
  3. Step 3: Edit with FIBO-Edit or GenFill/Erase using masks or text prompts, remove backgrounds if needed, then export

Best Practices

  • Define clear prompts and target specifications before you generate to guide the models
  • Use masks for region-specific edits to avoid unintended changes
  • Treat lighting, season, and style as independent controls to maintain brand consistency
  • Validate outputs for commercial-safety and avoid sensitive or copyrighted content
  • Leverage batch generation and pipelines to scale asset production efficiently

Example Use Cases

  • Hero product image for a website with a clean background and consistent lighting
  • Icon or illustration set generated from base concepts and refined with edits
  • E-commerce product photography with background removal and upscaling
  • Marketing banners produced via style transfer across multiple assets
  • Background-removed images prepared for slides or documents with consistent styling

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers