Skip to content
Help Build a Better ComfyUI Knowledge Base Become a Patron

Complete Guide to ComfyUI FLUX.1 Kontext: AI Image Editing and Prompt Tutorial

FLUX.1 Kontext is a generative model suite designed for text and image-driven editing. Unlike traditional text-to-image (T2I) models, Kontext supports context-based image processing, capable of understanding both image and text content to achieve more precise image editing capabilities.

Currently, Black Forest Labs has only released the API version, with the open-source version yet to be released. We will update this article with relevant tutorials once the open-source version is available. Currently, FLUX.1 Kontext can be used in ComfyUI through API nodes.

FLUX.1 Kontext Model Features

  • Continuous Image Editing: Maintains consistency across multiple editing steps
  • Precise Object Modification: Accurately modifies specific objects in images
  • Character Consistency Editing: Maintains character features across multiple editing steps
  • Style Preservation and Transfer: Can both maintain original style and perform style transfer
  • Image Text Editing: Directly edits text content in images
  • Composition Control: Precise control over image composition, camera angles, and poses
  • Fast Inference: Efficient image generation and editing speed

Using FLUX.1 Kontext in ComfyUI via API

FLUX.1 Kontext is currently provided in ComfyUI as API nodes. We will continue to update this tutorial after the open-source version is released. Please visit the ComfyUI Wiki for related articles written in the official ComfyUI documentation.

FLUX.1 Kontext API Node Official Tutorial

  1. Please update your ComfyUI Portable or Desktop to the latest version.
  2. In the menu bar, select Workflow -> Browse Templates -> Image API category to find FLUX.1 Kontext related templates.

FLUX.1 Kontext Template

Using API nodes requires you to log in and ensure sufficient balance in your account. Please refer to ComfyUI API Nodes Overview to learn about the credit system.

Since the corresponding nodes are very simple to use, basically just find the Flux.1 Kontext [pro] Image or Flux.1 Kontext [pro] Image node in the API Node and use the Load Image and Save Image nodes.

FLUX.1 Kontext (Max Image) Editing Steps

  1. Load the image to be edited in the Load Image node
  2. Modify necessary parameters in the Flux.1 Kontext Pro Image or Flux.1 Kontext Max Image node:
    • prompt Enter the prompt for the image you want to edit
    • aspect_ratio Set the aspect ratio of the original image, ratio must be between 1:4 and 4:1
    • prompt_upsampling Set whether to use prompt upsampling. If enabled, it will automatically modify the prompt to get richer results, but the results are not reproducible
  3. Click the Run button or use the shortcut Ctrl(cmd) + Enter to execute the image editing.
  4. After waiting for the API to return results, you can view the edited image in the Save Image node, and the corresponding image will also be saved to the ComfyUI/output/ directory.

ComfyUI Flux.1 Kontext Native Workflow

[To be updated]

Complete Guide to FLUX.1 Kontext Prompts

FLUX.1 Kontext Prompt Basics

Important Note: FLUX.1 Kontext has a maximum prompt limit of 512 tokens, please plan your prompt length accordingly.

Please write prompts in English Kontext’s core advantage lies in understanding image context - you only need to specify what you want to change, without needing to describe the entire scene in detail. This makes image editing simpler and more intuitive.

FLUX.1 Kontext Basic Object Modification

Kontext excels at direct object modification, such as changing colors or replacing objects.

Basic Modification Examples:

Modification TypePrompt ExampleEffect Description
Color Change”Change the car color to red”Only changes car color, keeps rest
Object Replacement”Change the flowers to yellow”Changes flower color
Simple Addition”Add an apple on the table”Adds new object to existing scene

Prompt Precision Level Comparison

Different levels of detail in prompts will produce different editing effects. Here’s a comparison of three precision levels:

Level Comparison Table

Precision LevelCharacteristicsAdvantagesDisadvantagesUse Cases
Simple EditConcise and directQuick and easyMay change styleQuick idea testing
Controlled EditAdd preservationMore stableSlightly longerNeed to preserve
Complex TransformDetailed allPrecise controlLonger promptsMultiple changes

Specific Example Comparison

Scenario: Changing night scene to daytime

Precision LevelPromptExpected Effect
Simple Edit”Change to daytime”Time changes, style may change
Controlled Edit”Change to daytime while maintaining the same style of the painting”Time changes, style preserved
Complex Transform”Change the setting to a day time, add a lot of people walking the sidewalk while maintaining the same style of the painting”Multiple changes, precise

Complete Style Conversion Guide

Style Conversion Principles Table

PrincipleDescriptionGood ExampleAvoid Example
Specify StyleUse specific names”Transform to Bauhaus art style""Make it artistic”
Reference MovementsMention specific”1960s pop art poster style""Modern art style”
Describe FeaturesDetail elements”Visible brushstrokes, thick paint texture""Make it look better”
Preserve ElementsSpecify retention”While maintaining the original composition and placement”No preservation

Style Conversion Prompt Comparison

Converting photo to painting style

Effect TypePromptResult Quality
❌ Basic (may lose detail)“Make it a sketch”Style change, detail loss
✅ Improved (preserves)“Convert to pencil sketch with natural graphite lines, cross-hatching, and visible paper texture”Style + details
✅ Best (full control)“Convert to pencil sketch with natural graphite lines, cross-hatching, and visible paper texture while maintaining all background details and features”Perfect balance

Common Style Conversion Prompt Templates

Style TypeRecommended Prompt Template
Oil Painting”Transform to oil painting with visible brushstrokes, thick paint texture, and rich color depth”
Watercolor”Convert to watercolor painting with transparent colors, paper texture, and natural paint flow effects”
Pencil Sketch”Convert to pencil sketch with natural graphite lines, cross-hatching, and visible paper texture”
Anime Style”Transform to anime style with clear lines, vibrant colors, and typical anime character features”
Claymation”Restyle to Claymation style with 3D sculpted texture and soft lighting effects”

FLUX.1 Kontext Character Consistency Editing Framework

Character Consistency Three-Step Method

StepPurposeExampleImportance
1. Establish ReferenceDefine identity”The woman with short black hair”⭐⭐⭐⭐⭐
2. Specify ChangeState changes”Now in a tropical beach setting”⭐⭐⭐⭐
3. Retention MarkSpecify features”While maintaining the same facial features and expression”⭐⭐⭐⭐⭐

Character Description Word Comparison

Description MethodEffectExampleRecommendation
❌ Pronoun ReferenceConfusing”She”, “He”, “This person”Not recommended
✅ Specific DescriptionClear identity”The woman with short black hair”Strongly recommended
✅ Feature MarkingPrecise identification”The man with glasses”, “The girl in red coat”Recommended

Sequential Editing Example Sequence

Character: Young Woman

Edit StepPromptGoal
Step 1”She’s now taking a selfie in a street in Freiburg, it’s a lovely day out”Change environment and activity
Step 2”Remove the thing from her face”Remove specific item
Step 3”It’s now snowing, everything is covered in snow”Change weather environment

Text Editing Special Techniques

Text Editing Syntax Rules

Edit TypeSyntax FormatExample
Replace Text”Replace ‘[original text]’ with ‘[new text]‘""Replace ‘joy’ with ‘BFL‘“
Modify Style”Replace ‘[original text]’ with ‘[new text]’ while maintaining [style requirements]""Replace ‘SALE’ with ‘OPEN’ while maintaining the same font style and color”
Add Text”Add text ‘[content]’ at [position]""Add text ‘WELCOME’ on the sign”

Text Editing Best Practices Comparison

PracticeEffectExample
✅ Use quotesPrecise text identification”Replace ‘OPEN’ with ‘CLOSED’”
❌ No quotesMay cause errors”Change OPEN to CLOSED”
✅ Specify styleMaintain visual effect”While maintaining the same font style and color”
❌ No specificationMay change overall designOnly specify text content

FLUX.1 Kontext Troubleshooting Reference

Common Problems and Solutions

Problem TypeProblem ManifestationError ExampleCorrect Solution
Character Identity ChangeExcessive facial feature changes”Transform the person into a Viking""Transform the man into a viking warrior while preserving his exact facial features, eye color, and facial expression”
Composition ShiftSubject position or scale changes”Put him on a beach""Change the background to a beach while keeping the person in the exact same position, scale, and pose”
Style Detail LossLoss of important details during style conversion”Make it a sketch""Convert to pencil sketch with natural graphite lines, cross-hatching, and visible paper texture while preserving all scene details”
Unexpected Element ChangeUnwanted modifications”Change to daytime""Change to daytime while everything else should stay black and white and maintain the original style”

Verb Choice Impact on Results

Verb TypeMeaning StrengthApplicable ScenariosExample
”Transform”Complete changeWhen style is completely changed”Transform to oil painting style"
"Change”Partial modificationWhen modifying specific elements”Change the clothing color"
"Replace”Direct replacementWhen replacing objects or text”Replace the background with forest"
"Add”Add elementWhen adding elements”Add a small bird"
"Remove”Remove elementWhen removing unwanted content”Remove the cars from background”

FLUX.1 Kontext Advanced Prompt Combination Techniques

Multi-Edit Prompt Structure

Template Format: [Main Modification] + [Preservation Requirements] + [Detail Description]

Actual Example:

Edit RequirementsPrompt Organized by Template
Change Background + Keep Person”Change the background to a forest scene while keeping the person in exactly the same position and pose, maintaining the original lighting”
Style Conversion + Keep Composition”Transform to watercolor painting style while maintaining the original composition and all object positions, using soft color transitions”
Multi-Object Modification”Change the car to red and the sky to sunset colors while keeping the road and buildings in their original appearance”

Prompt Priority Guide

PriorityContent TypeExample
HighestKeep Character Identity”While maintaining the exact same facial features”
HighMain Modification Target”Change the background to beach”
MediumStyle and Texture”Using watercolor painting style”
LowDetail Supplement”Add soft lighting effects”

FLUX.1 Kontext Prompt Checklist

Before using prompts, please check the following points:

Basic Check Items

  • Is the content to be modified specified clearly?
  • Is the element that needs to be kept unchanged described?
  • Is the prompt length within the 512 token limit?
  • Is a specific rather than vague description used?

Advanced Check Items

  • Is a specific description used instead of pronouns when editing characters?
  • Is a specific feature described when converting styles?
  • Is quotation marks used when editing text?
  • Is the appropriate verb (transform/change/replace) selected?

Through this comprehensive prompt guide, you can better master the use of FLUX.1 Kontext to achieve more precise image editing effects.

FLUX.1 Kontext Prompt Best Practices Summary

  1. Specific and Clear: Precise language brings better results. Use accurate color names, detailed descriptions, and clear action verbs to avoid vague terms.
  2. Start Simple: Before adding complexity, start with core changes. First test basic edits, then build on successful results.
  3. Intended Preservation: Clearly state what should remain unchanged. Use phrases like “while maintaining the same [facial features/composition/lighting]” to protect important elements.
  4. Iterate When Necessary: Complex transformations often require multiple steps. Decompose drastic changes into sequential edits for better control.
  5. Directly Name the Subject: Use “The woman with short black hair” or “The red car” instead of “She”, “It”, or “This” etc.
  6. Text Use Quotes: Quote the exact text you want to change: “Replace ‘joy’ with ‘BFL’” is better than general text descriptions.
  7. Explicit Composition Control: When changing background or settings, specify “Keep accurate camera angle, position, and composition” to prevent unnecessary repositioning.
  8. Carefully Select Verbs: “Transform” may imply a complete change, while “Change clothing” or “Replace background” allows you to better control the actual changes.

Remember: It’s always beneficial to make content more explicit when the number of instructions for each edit is not too complex.