FLUX.1 Kontext [pro] is a model designed for Text-to-Image generation and advanced Image Editing. This guide focuses on its Image Editing capabilities. Unlike other models, you don’t need to fine-tune or create complex workflows to achieve this - Flux.1 Kontext [pro] handles it out of the box.

Kontext’s image editing, accessed via the /flux-kontext-pro endpoint, provides the following key functionalities:

  • Simple Editing: Change specific parts of an image while keeping the rest untouched
  • Smart Changes: Make edits that look natural and fit with the rest of the image
  • Text in Images: Add or modify text within your images

For comprehensive prompting techniques and advanced editing strategies, see our detailed Prompting Guide - Image-to-Image.

Examples of Editing

Basic Object Modifications

FLUX.1 Kontext is really good at straightforward object modification, for example if we want to change the colour of an object, we can prompt it.

For example: Change the car color to red

Before editing

After editing

Iterative Editing

FLUX.1 Kontex excels at character consistency, even after multiple edits. Starting from a reference picture, we can see that the character is consistent throughout the sequence.

First edit

Second edit

Third edit

Fourth edit

Text Editing

FLUX.1 Kontext can directly edit text that appears in images, making it easy to update signs, posters, labels, and more without recreating the entire image.

The most effective way to edit text is using quotation marks around the specific text you want to change:

Prompt Structure: Replace '[original text]' with '[new text]'

Example - We can see below where we have an input image with “Choose joy” written, and we replace “joy” with “BFL” - note the upper case format for BFL.

Input image

JOY replaced with BFL

Input image

Sync & Bloom changed to 'FLUX & JOY'

Using FLUX.1 Kontext API for Image Editing

This requires both a text prompt and an input image to work, with the input image serving as the base that will be edited according to your prompt.

To use Kontext for image editing, you’ll make a request to the /flux-kontext-pro endpoint:

Create Request

# Install `curl` and `jq`, then run:
request=$(curl -X POST \
  'https://api.bfl.ai/v1/flux-kontext-pro' \
  -H 'accept: application/json' \
  -H "x-key: ${BFL_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "<What you want to edit on the image>",
    "input_image": "<base64 converted image>",
}')
echo $request
request_id=$(jq -r .id <<< $request)

A successful response will be a json object containing the request’s id, that will be used to retrieve the actual result.

Poll for Result

After submitting a request, you need to poll the /v1/get_result endpoint using the request_id to check the status and retrieve the output when ready.

while true
do
  sleep 1.5
  result=$(curl -s -X 'GET' \
    "https://api.bfl.ai/v1/get_result?id=${request_id}" \
    -H 'accept: application/json' \
    -H "x-key: ${BFL_API_KEY}")
  status=$(jq -r .status <<< $result)
  echo "Status: $status"
  if [ "$status" == "Ready" ]
  then
    echo "Result: $(jq -r .result.sample <<< $result)"
    break
  elif [ "$status" != "Processing" ] && [ "$status" != "Queued" ] 
  then
    echo "An error or unexpected status occurred: $result"
    break
  fi
done

A successful response will be a json object containing the result, and result['sample'] is a signed URL for retrieval.

Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe.

FLUX.1 Kontext Image Editing Parameters (for /flux-kontext-pro)

List of Kontext parameters for image editing via the /flux-kontext-pro endpoint:

ParameterDescriptionDefaultRange
promptText description of what you want to generateRequired
input_imageBase64 encoded image to use as referenceRequired
seedOptional seed for reproducibilityNoneAny integer
safety_toleranceModeration level (0=strict, 6=permissive)20-6
output_formatFormat of the output image”jpeg""jpeg”, “png”
webhook_urlURL for asynchronous completion notificationNoneValid URL
webhook_secretSecret for webhook signature verificationNoneString