The Bria API

We are happy to answer any questions you may have at: support@bria.ai

Introduction

The Bria API is designed to provide a comprehensive suite of tools for generating and customizing images. With Bria, you can:

  • Generate Images Using Bria Models: Utilize pre-trained Bria models to generate high-quality images based on text prompts.

  • Train Your Own Tailored Models: Create models that preserve and faithfully reproduce your visual IP, ensuring consistency across all generated outputs.

  • Generate Vector Graphics (beta): Use the base and tailored models API endpoints to create versatile, editable vector graphics from text prompts.

  • Enhance Product Imagery with eCommerce Suite: Use specialized features to create professional product shots, packshots, and lifestyle images for eCommerce platforms.

  • Edit and Transform Images: Bring your own images and edit them using various routes to suit your needs.

  • Edit Videos (New!): Transform video content with advanced AI capabilties, starting with Background Removal, and more features coming soon.

This document provides an overview of the API's capabilities and guides users on how to effectively implement them.

Bria's Sandbox

Try out Bria's API endpoints directly in our sandbox environment here.

Using Bria for Image Generation

Image Generation:

  • Use the /text-to-image endpoints to generate any image you would like, based on the provided prompt, without needing to upload or register images first.

  • Utilize the /reimagine endpoint to generate new images based on reference images, incorporating elements such as structure, composition, or style from existing visuals.

  • Enhance your prompts with the /prompt_enhancer route or use the built-in prompt enhancement feature in /text-to-image routes to create more detailed and vivid descriptions, resulting in richer and more diverse image outputs.

Tailored Generation: The Tailored Generation API allows you to manage and train Tailored Models that preserve and faithfully reproduce your visual IP (photos, illustrations, vectors). You can train Tailored Models through our Console or implement training on your platform via API. Check out our Console here.

Training Process Overview

To train a tailored generation model:

  1. Create a Project: Use the /projects endpoint to create a project and define your IP type and medium.
  2. Create a Dataset: Use the /datasets endpoint to create a dataset within your project.
  3. Upload Images: Upload images to your dataset using the /datasets/{dataset_id}/images endpoint. Images must be 1024x1024px minimum.
  4. Prepare Dataset: Review auto-generated captions and use the /datasets/{id} endpoint to set status to 'completed'.
  5. Create Model: Use the /models endpoint to create a model, selecting light or max training version.
  6. Start Training: Initiate training using the /models/{id}/start_training endpoint. Training takes 1-3 hours.
  7. Monitor Progress: Check training status using the /models/{id} endpoint until status shows 'Completed'.
  8. Generate Images: Once trained, your model can be used in multiple ways:
  • Use the /text-to-image/tailored/{model_id} endpoint for text-to-image generation
  • Use the /text-to-vector/tailored/{model_id} endpoint for generating illustrative vector graphics
  • Use the /reimagine/tailored/{model_id} endpoint for generating using a structure refernce image
  • Access through the Bria platform interface

eCommerce Suite

Bria offers a variety of solutions for products and apps in the eCommerce industry, which allow to enhance product imagery for online stores and product catalogs. These solutions include:

  • /cutout: Create clean and professional product cutouts.

  • /packshot: Generate professional-standard packshots with customizable background colors and optimal product placement.

  • /shadow: Add consistent and customizable shadow effects, supporting regular and floating shadows for product images with transparent backgrounds.

  • /lifestyle_shot_by_text: Enrich product images by placing them in various environments using textual descriptions, enhancing appeal and providing context.

  • /lifestyle_shot_by_image: Generate product images in enriched environments using a reference image for inspiration, allowing for creative and unique presentations.

Video Editing

Bria's new Video Editing product suite empowers users to transform video content effortlessly. The first feature, Background Removal, allows users to remove backgrounds from videos while retaining the original resolution and framerate. This capability supports a variety of formats, including mp4, avi, and mov. More features will be introduced soon, expanding the suite to meet diverse video editing needs.

Editing Images

Bria supports both isolated and registration-required routes for editing images:

Isolated Routes (no registration required):

  • /increase_resolution - Upscale any image.

  • /image_expansion - Expand the image beyond its original borders.

  • /crop - Crop an image tightly around the region of interest without a background.

  • /background/remove - Remove the background of an image.

  • /background/blur - Create a blur effect on the background.

  • /background/replace - Generate new backgrounds for an image.

  • /erase_foreground - Erase the foreground from a provided image.

  • /eraser - Erase elements from an image using manually created or auto-generated masks.

  • /gen_fill (coming soon) - GenFill generates objects in a specific region of an image, using a mask and a textual prompt.

  • /caption - Generate a caption describing the given image.

Soon to be Isolated:

  • /mask_generator - Retrieve all available masks for an image, creating a full segmenration of the image.
  • /image_to_psd - Create a layered PSD file from any image.

Uploading and Registering Images:

  • Use the /register endpoint to send a new image to Bria without being uploaded to the database. This is the recommended method to onboard images to Bria when needed.

With the response from the Upload/Register Routes (visual_id), the following routes can be used without any particular order:

  • /campaign_generator - The Campaign Generator Route enables the creation of customized campaigns. It allows for the generation of visual ads, including various elements like text, images, and layout, based on specific parameters provided by the user.
  • /person/info (soon to be deprecated) - By using the /person/info route, you can understand the possible changes for every people in the image.
  • /person/modify - Modify person-related elements in the image. In order to use this route you shuold first use the route /person/info.
  • /search - Utilizing the Search Route to look for images you uploaded or registered to Bria that match a text query.
  • /search_similar_images - Utilizing the Search Similar Images Route to look for images you uploaded or registered to Bria that match the chosen image.

Authentication

The Bria API consists of a number of methods for uploading and creating new visual assets. The REST (representational state transfer) API methods can be called directly from within your own custom code.

curl --location --request POST 'https://engine.prod.bria-api.com/v1' \
--header: 'api_token: <...>' \
...

API Access

You can register and access the API Token through Bria's platform by clicking here.