ComfyUI Flux.1 Kontext Pro Image API Node Official Example
This guide will show you how to use the Flux.1 Kontext Pro Image API node in ComfyUI to perform image editing
FLUX.1 Kontext is a professional image-to-image editing model developed by Black Forest Labs, focusing on intelligent understanding of image context and precise editing.
It can perform various editing tasks without complex descriptions, including object modification, style transfer, background replacement, character consistency editing, and text editing.
The core advantage of Kontext lies in its excellent context understanding ability and character consistency maintenance, ensuring that key elements such as character features and composition layout remain stable even after multiple iterations of editing.Currently, ComfyUI has supported two models of Flux.1 Kontext:
Kontext Pro is ideal for editing, composing, and remixing.
Kontext Max pushes the limits on typography, prompt precision, and speed.
In this guide, we will briefly introduce how to use the Flux.1 Kontext API nodes to perform image editing through corresponding workflows.
To use the API nodes, you need to ensure that you are logged in properly and using a permitted network environment. Please refer to the API Nodes Overview section of the documentation to understand the specific requirements for using the API nodes.
Workflows in this guide can be found in the Workflow Templates.
If you can’t find them in the template, your ComfyUI may be outdated.(Desktop version’s update will delay sometime)If nodes are missing when loading a workflow, possible reasons:
You are not using the latest ComfyUI version(Nightly version)
You are using Stable or Desktop version (Latest changes may not be included)
We have recently updated to support multiple image input workflows. Using the new Image Stitch node, you can stitch multiple images into a single image and edit it using Flux.1 Kontext.
The metadata of the images below contains the workflow information. Please download and drag them into ComfyUI to load the corresponding workflow.Download the following images for input or use your own images:
You can follow the numbered steps in the image to complete the workflow:
Upload the provided images in the Load image node
Modify the necessary parameters in Flux.1 Kontext Pro Image:
prompt Enter the prompt for the image you want to edit
aspect_ratio Set the aspect ratio of the original image, which 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
Click the Run button or use the shortcut Ctrl(cmd) + Enter to execute the image editing
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
The subsequent two workflows only differ in the API nodes used. In fact, you only need to modify based on the multiple image input workflow, with no significant differences
The metadata of the image below contains the workflow information. Please download and drag it into ComfyUI to load the corresponding workflow.Download the image below for input or use your own image:
You can follow the numbered steps in the image to complete the workflow:
Load the image you want to edit in the Load Image node
(Optional) Modify the necessary parameters in Flux.1 Kontext Pro Image
Click the Run button or use the shortcut Ctrl(cmd) + Enter to execute the image editing
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
The metadata of the image below contains the workflow information. Please download and drag it into ComfyUI to load the corresponding workflow.Download the image below for input or use your own image for demonstration:
You can follow the numbered steps in the image to complete the workflow:
Load the image you want to edit in the Load Image node
(Optional) Modify the necessary parameters in Flux.1 Kontext Max Image
Click the Run button or use the shortcut Ctrl(cmd) + Enter to execute the image editing
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
Object Modification:"Change [object] to [new state], keep [content to preserve] unchanged"Style Transfer:"Transform to [specific style], while maintaining [composition/character/other] unchanged"Background Replacement:"Change the background to [new background], keep the subject in the exact same position and pose"Text Editing:"Replace '[original text]' with '[new text]', maintain the same font style"
Remember: The more specific, the better. Kontext excels at understanding detailed instructions and maintaining consistency.