Skip to content

02. Image Editing (Image Editing)

If image generation is the task of “creating something from nothing,” then Image Editing is the task of “modifying an existing image in a desired direction.”

AI-based image editing can automatically perform complex modifications using only text prompts or masks.

The main editing types supported in ComfyUI are as follows:

Editing TypeRepresentative Use Cases
InpaintingRemoving unwanted objects, face correction, outfit replacement
OutpaintingBackground expansion
RelightingDay-to-night conversion, changing lighting direction
Context-aware EditingCharacter style transfer, product mockups
Instruction-based EditingSimple object replacement and modification

Inpainting is a technique where you designate a specific area of an image with a Mask, and only that area is filled with new content. A mask is like an instruction saying “please redraw this part.”

Original image + Mask (area to edit) + Text
-> Only the masked area is regenerated
-> The rest of the image is preserved

Representative Workflow: Flux.1 Fill Inpainting

Section titled “Representative Workflow: Flux.1 Fill Inpainting”

This is an inpainting workflow using the Flux.1 Fill Dev model.

Inpainting Workflow

Key Components:

NodeRole
DualCLIPLoaderLoads two text encoders, clip_l and t5xxl, with the “flux” type
Load Diffusion ModelLoads the flux1-fill-dev.safetensors model
FluxGuidanceSets prompt adherence strength (default value 30)
InpaintModelConditioningPasses the original image and mask to the model

Before

After


Outpainting is a technique that extends the canvas beyond the image boundaries to generate new content. It naturally fills surrounding areas while maintaining the style and content of the original image.

Original image
-> ImagePadForOutpaint (how much to extend in each direction)
-> Generate a mask for the extended area
-> Generate the extended area based on text

Representative Workflow: Flux.1 Outpainting

Section titled “Representative Workflow: Flux.1 Outpainting”

This uses the same flux1-fill-dev.safetensors model as inpainting, but with additional padding and blending nodes.

Outpainting Workflow

Key Nodes:

NodeRole
ImagePadForOutpaintSets padding size and feathering for each direction. Extension pixels can be specified individually per direction
DifferentialDiffusionSmoothly blends the boundary between the original and extended areas

Relighting is a technique for changing the lighting of an image. You can control the lighting direction and intensity via text, such as changing from daytime to nighttime, or switching from side lighting to backlighting.

Representative Workflow: Qwen Image Relight

Section titled “Representative Workflow: Qwen Image Relight”

This workflow applies a Relight LoRA to the Qwen Edit 2509 model.

Relighting Workflow

Key Components:

ItemDetails
Modelqwen_image_edit_2509_fp8_e4m3fn.safetensors
LoRALightning 4-step LoRA + Relight LoRA
Trigger WordChinese trigger word “重新照明,” (meaning “relight”)
Prompt Format”重新照明,” + desired lighting description (in English)

Instruction-based Editing is a method of modifying images using only text, without masks. It uses intuitive commands such as “remove the text.”

This is the most versatile instruction-based editing workflow.

  • Example prompt: “Remove all UI text elements”

Text-based Editing Workflow


Context-aware Editing is a technique for changing the style, background, attributes, and more of a character or object while preserving its appearance. Unlike regular editing, it “remembers” the key features of the input image to ensure consistency.

The Flux.1 Kontext Dev model is an editing model specialized in character consistency.

Kontext Workflow

Key Features:

  • Can accept 1-2 reference images as input
  • Character consistency: Transform the same character into different poses/backgrounds
  • Style Transfer: Change the artistic style of an image
  • Text editing: Modify text within an image
  • Object modification: Change attributes of specific objects

WorkflowEditing TypeModelInputFeatures
Flux.1 Fill InpaintInpaintingFlux.1 Fill DevImage+Mask+TextText-based fill of masked area
Flux.1 OutpaintOutpaintingFlux.1 Fill DevImage+TextCanvas extension, padding/feathering settings
Qwen RelightRelightingQwen Edit 2509Image+TextLighting change, trigger word required
Qwen Image EditGeneral EditQwen Image EditImage+TextGeneral-purpose editing, turbo mode
Flux KontextContext EditFlux.1 KontextImage (1-2)+TextCharacter consistency, style transfer