{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab"]},"type":"markdown"},"seo":{"title":"Working with images and video","description":"Generate and edit images and video with Bria's FIBO models through a REST API, Python SDK, MCP server and agent skills. Licensed training data, controllable output, provenance on every result.","siteUrl":"https://docs.bria.ai","image":"/assets/logo.4aab4827f8ef484ab0149a267109951af9b35a6e5d7ddacfc52a0cb2bf07aec6.db81178d.png","llmstxt":{"hide":false,"title":"Bria API documentation","description":"Bria's developer platform: controllable, commercially safe visual generative AI (images and video) as a REST API, Python SDK, MCP server and agent skills.","details":{"path":"_llmstxt-details.md"},"sections":[{"title":"Getting started","description":"First call, authentication, async jobs and webhooks, rate limits, inputs.","includeFiles":["index.md","getting-started/quickstart.md","getting-started/authentication.md","getting-started/async-requests.md","status.yaml","getting-started/rate-limits-and-errors.md","getting-started/working-with-images.md"]},{"title":"Integrate","description":"Python SDK, MCP server, agent skills, and machine-readable docs for agents.","includeFiles":["integration-methods/python-sdk.md","MCP-authentication.md","integration-methods/bria-skill.md","integration-methods/for-ai-agents.md"]},{"title":"Concepts","description":"Platform map, VGL and the FIBO models, safety, best practices.","includeFiles":["products-overview.md","VGL.md","safety.md","best-practices-overview.md","image-generation-best-practices.md","image-editing-best-practices.md","product-shots-best-practices.md"]},{"title":"Image Generation","description":"Generate images from text, reference images or structured (VGL) prompts with FIBO.","includeFiles":["image-generation-overview.md","image-generation.yaml"]},{"title":"Image Editing","description":"Instruction-based editing plus specialized endpoints for backgrounds, erasing, fill, expansion, upscaling and style.","includeFiles":["image-editing-overview.md","image-editing.yaml"]},{"title":"Product Shot Editing","description":"Cutouts, packshots, shadows, lifestyle scenes, product integration, holding, virtual try-on, automotive.","includeFiles":["product-shot-overview.md","product-shot-editing.yaml"]},{"title":"Video Editing","description":"Background removal (REST or real-time streaming), erasing, upscaling and masks for video; local video upload.","includeFiles":["video-editing-overview.md","local-video-upload-service.md","streaming-rmbg.md","video-editing.yaml"]},{"title":"Ad Delayer","description":"Turn a flat ad into editable layers; the guide holds the layer document contract.","includeFiles":["ad-delayer-overview.md","ad-delayer.yaml"]},{"title":"Trust and provenance","description":"Public verification of Bria provenance, and attribution of outputs to licensed training data.","includeFiles":["trust-and-provenance-overview.md","visual-verification-overview.md","visual-verification.yaml","enterprise/attribution.md","bria-attribution-service.yaml"]},{"title":"Enterprise","description":"Run Bria in your own cloud or on-premises.","includeFiles":["enterprise/deployment-options.md"]}],"excludeFiles":["_llmstxt-details.md","README.md"]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"working-with-images-and-video","__idx":0},"children":["Working with images and video"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"image-inputs","__idx":1},"children":["Image inputs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every v2 endpoint that takes an image accepts the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["image"]}," field in one of two forms:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Form"},"children":["Form"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Rules"},"children":["Rules"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Public URL"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Must be reachable by Bria's servers at processing time (no authentication, no expired signed links)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Base64 string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The raw encoded bytes only. Do not include a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data:image/png;base64,"]}," prefix."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Supported formats are JPEG, PNG and WEBP. Endpoints that take several images (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["images"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ref_images"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mask"]},") accept either form for each item."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send a local file:"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python SDK","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from bria_client import BriaSyncClient\nfrom bria_client.toolkit import Image\n\nclient = BriaSyncClient()\nresponse = client.run(\n    endpoint=\"image/edit/remove_background\",\n    payload={\"image\": Image(\"product.jpg\").as_bria_api_input},  # local path, URL, PIL image or numpy array\n)\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"JavaScript / TypeScript","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"import { readFile } from \"node:fs/promises\";\n\nconst image = (await readFile(\"product.jpg\")).toString(\"base64\");\nconst response = await fetch(\"https://engine.prod.bria-api.com/v2/image/edit/remove_background\", {\n  method: \"POST\",\n  headers: { api_token: process.env.BRIA_API_TOKEN ?? \"\", \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({ image }),\n});\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"cURL","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://engine.prod.bria-api.com/v2/image/edit/remove_background \\\n  -H \"api_token: $BRIA_API_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"image\\\": \\\"$(base64 -w0 product.jpg)\\\"}\"\n","lang":"bash"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"image-outputs","__idx":2},"children":["Image outputs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Results are delivered as a URL in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.image_url"]},". Download and store the file yourself; result URLs are temporary. Where an endpoint offers ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["output_type"]},", choose ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["png"]}," to keep transparency and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["jpeg"]}," for smaller files. Endpoints that preserve alpha expose ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["preserve_alpha"]}," (default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"), which keeps transparency from the input in the output."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"masks","__idx":3},"children":["Masks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Mask-based endpoints (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/edit/erase"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/edit/gen_fill"]},", masked ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/edit"]},") take a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mask"]}," image the same size as the input. The masked region is regenerated, so paint slightly beyond the object edge to give the model room to blend, especially around hair, glass and fabric. The endpoint page describes the mask polarity and format it expects. The ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/image-editing-best-practices"},"children":["Image Editing best practices"]}," guide covers how to prompt for masked regions."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"reference-and-multi-image-requests","__idx":4},"children":["Reference and multi-image requests"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/generate"]}," accepts a single reference image in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["images"]}," alongside an optional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prompt"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/edit"]}," accepts one to four ordered images; refer to them in the instruction as \"image 1\", \"image 2\" and so on. Masks are supported for single-image requests only."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/v2/image/edit/replace_background"]}," accepts reference images that guide the new background."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"structured-prompts","__idx":5},"children":["Structured prompts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Generation endpoints return the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/vgl"},"children":["VGL"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["structured_prompt"]}," used to render the image as a JSON string. Store it with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["seed"]},"; sending both back reproduces the image, and adding a short ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["prompt"]}," refines it while keeping the composition."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"video-inputs","__idx":6},"children":["Video inputs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Video endpoints take a public ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["video"]}," URL. For a local file, request a presigned upload from the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/local-video-upload-service"},"children":["Video Upload Service"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /v2/video/upload"]},"), upload the file, and pass the returned ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["file_url"]},". Uploaded files are kept for one day; the SDK wraps this flow in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.upload()"]},". For live sources use ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/streaming-rmbg"},"children":["Streaming Background Removal"]}," over WebSocket instead."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"content-moderation-of-inputs","__idx":7},"children":["Content moderation of inputs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Input images can be screened before processing with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["visual_input_content_moderation"]},". Blocked inputs return ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["422"]},". See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/safety"},"children":["Safety and transparency"]},"."]}]},"headings":[{"value":"Working with images and video","id":"working-with-images-and-video","depth":1},{"value":"Image inputs","id":"image-inputs","depth":2},{"value":"Image outputs","id":"image-outputs","depth":2},{"value":"Masks","id":"masks","depth":2},{"value":"Reference and multi-image requests","id":"reference-and-multi-image-requests","depth":2},{"value":"Structured prompts","id":"structured-prompts","depth":2},{"value":"Video inputs","id":"video-inputs","depth":2},{"value":"Content moderation of inputs","id":"content-moderation-of-inputs","depth":2}],"frontmatter":{"title":"Working with images and video","description":"How to pass images and videos to the Bria API: URLs, base64, formats, masks, reference images and local video uploads.","seo":{"title":"Working with images and video"}},"lastModified":"2026-09-27T11:58:15.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/getting-started/working-with-images","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}