Skip to main content
KI-TOOLS
INTERMEDIATE
9 MIN

Change a Photo Background with Flux Kontext – Free & Local in ComfyUI (2026)

Swap a photo's background with a text prompt – the person, pose and clothing stay pixel for pixel. Tested locally on an RTX 3060 (12 GB) with Flux Kontext GGUF, no subscription.

Change a photo background with Flux Kontext – the same person in front of a grey studio is placed into a sunny park by prompt, pose and clothing stay the same
Change a photo background with Flux Kontext – the same person in front of a grey studio is placed into a sunny park by prompt, pose and clothing stay the same

Ask ChatGPT to swap your photo's background and you get back a new person. Different face, different pose, different shirt. The background is right, but the subject is gone.

Flux Kontext does the opposite: it swaps only the background. The person, their pose and their clothing stay pixel for pixel the same – only the surroundings change. That's the difference between "a new image" and "edit this image".

This guide walks the whole path – tested locally on an RTX 3060 with 12 GB of VRAM, free, no cloud required. And no add-on model: background swaps are something Kontext does out of the box.

Updated: July 2026 · ComfyUI (current) · Flux.1 Kontext Dev as GGUF · Custom node "ComfyUI-GGUF"

What you'll get:

  • Why Kontext keeps the person – while ChatGPT reinvents them
  • The 4 model files and exactly where they go
  • The ComfyUI workflow in 4 steps – with the GGUF trick for 12 GB cards
  • The right prompt wording for background swaps
  • One photo, any number of backgrounds – the prompt templates
  • Fixes for when the person changes along with the background

Kontext vs. "ChatGPT could've done that too"

The key term is image conditioning. Kontext gets your original image not as a vague description but as a fixed reference point (the ReferenceLatent node in the workflow). The model holds everything you don't mention constant and computes only the named change.

In practice:

  • One photo, one prompt, one new background – no redrawing of the person.
  • The subject's face, pose, clothing and lighting stay intact.
  • You can place the same photo into any number of scenes – studio, café, nature.

That's the practical lever: put portraits, team photos, model shots or product images into any environment from one source shot – no second shoot, no hand-cutouts.

From photo to result in four steps: load models, image and prompt, Kontext sampling, result
From photo to result in four steps: load models, image and prompt, Kontext sampling, result

Requirements

WhatRecommendation
Graphics cardNVIDIA with ≥ 8 GB VRAM (tested on RTX 3060/12 GB)
SoftwareComfyUI (current version)
Custom nodeComfyUI-GGUF (for the GGUF loader)
Storage~ 12 GB free for the model files

💡 Tip: We deliberately use the GGUF variant of Flux Kontext (Q4_K_M, ~6.8 GB). GGUF is a compressed format – so a 12-billion-parameter model runs smoothly on a 12 GB card, where the full fp16 version (~24 GB) would be far too large.

⚠️ Warning: ComfyUI Desktop and the portable version do not share models. Put the files in the models folder of the version you actually launch.

RunPodEmpfohlenes Tool · Cloud-GPU

Keine starke Grafikkarte? Führe ComfyUI in der Cloud aus.

Flux & SDXL sind speicherhungrig. Statt ~1.800 € für eine eigene Karte mietest du bei RunPod eine 24-GB-GPU ab ca. 0,50 €/Stunde – und zahlst nur, was du nutzt.

GPU mieten & Flux starten →Affiliate-Link · für dich ohne Mehrkosten

Step 1: Install the custom node "ComfyUI-GGUF"

The GGUF loader isn't a default node – it comes via the Manager:

  1. Start ComfyUI → click Manager on the right.
  2. Open Custom Nodes Manager → search for ComfyUI-GGUF → Install.
  3. Fully restart ComfyUI.

Without this step, the "Unet Loader (GGUF)" node is missing later and the workflow stays red.


Step 2: Download the four models and place them right

Flux Kontext has four parts: the main model, two text encoders and a VAE. No add-on model needed – the background swap lives in the base model.

FileSourceFolder
flux1-kontext-dev-Q4_K_M.gguf🤗 HuggingFace: QuantStack/FLUX.1-Kontext-dev-GGUFmodels/unet/
t5xxl_fp8_e4m3fn.safetensors🤗 comfyanonymous/flux_text_encodersmodels/text_encoders/
clip_l.safetensors🤗 comfyanonymous/flux_text_encodersmodels/clip/
ae.safetensors🤗 black-forest-labs/FLUX.1-schnell (VAE)models/vae/

The folder structure then looks like this:

📁 ComfyUI/
└── 📁 models/
    ├── 📁 unet/
    │   └── flux1-kontext-dev-Q4_K_M.gguf
    ├── 📁 text_encoders/
    │   └── t5xxl_fp8_e4m3fn.safetensors
    ├── 📁 clip/
    │   └── clip_l.safetensors
    └── 📁 vae/
        └── ae.safetensors
Which model goes where: unet, text_encoders, clip and vae with their respective files
Which model goes where: unet, text_encoders, clip and vae with their respective files

📌 Note: After copying, restart ComfyUI once, otherwise the models won't show up in the dropdowns.


Step 3: Load the Kontext workflow – with the GGUF trick

You build nothing by hand. ComfyUI ships the workflow as a template:

  1. Click Workflow → Browse Templates at the top.
  2. Category Flux → pick "Flux.1 Kontext Dev (Basic)". The full graph loads automatically.
  3. Now the one important move for 12 GB cards: delete the "Load Diffusion Model" node. Right-click the canvas → Add Node → bootleg → Unet Loader (GGUF) → select flux1-kontext-dev-Q4_K_M.gguf → reconnect the MODEL output to the KSampler.

Quickly check the remaining loaders:

  • DualCLIPLoader → t5xxl_fp8_e4m3fn + clip_l, type: flux
  • VAELoader → ae.safetensors

🔑 Remember: The default template loads the full model via "Load Diffusion Model". That single node gets swapped for Unet Loader (GGUF) – the rest of the workflow stays identical.


Step 4: Load image, write the prompt, generate

1. Load image. Upload your source photo in the Load Image node.

2. Write the prompt. Put the new scene in the positive prompt – Flux is most reliable in English. The crucial addition: explicitly pin the person.

change the background to a green city park on a sunny day, keep the person and clothing exactly the same

3. Set the parameters. The tested values for Kontext:

ParameterValueWhy
Samplereulerstable for Flux
Schedulersimplestandard for Kontext
Steps8fast & tested; 20 for maximum detail
Guidance2.5Kontext standard – higher = more literal
CFG1.0fixed for Flux

4. Generate. Click Queue Prompt.

🧪 Try it: The first run takes ~2 minutes because the model loads into VRAM. Every further background runs at ~30–60 seconds on the RTX 3060.

Result: the person now stands in the park – face, pose, t-shirt and jeans unchanged.


One photo, any number of backgrounds

Because the subject stays fixed, every further background is just a new prompt. The same photo – studio, café, nature:

One photo, three backgrounds: the same person in front of a white studio, in a café and in a park
One photo, three backgrounds: the same person in front of a white studio, in a café and in a park

Kontext is precise when you are. Two rules:

  • Name the scene concretely – place, light, mood. "a cozy sunlit cafe interior with warm bokeh" beats "nice background".
  • Pin the person. The addition keep the person and clothing exactly the same stops Kontext from computing over the subject.

A few proven templates:

BackgroundPrompt
Studio whitechange the background to a clean seamless white studio backdrop, keep the person exactly the same
Café / indoorchange the background to a cozy sunlit cafe interior with warm bokeh, keep the person exactly the same
Nature / parkchange the background to a green city park on a sunny day, keep the person exactly the same
Beachchange the background to a sandy beach at golden hour, keep the person exactly the same
Gradientchange the background to a soft pastel gradient studio backdrop, keep the person exactly the same

Person changes too? Quick fixes

ProblemCauseFix
Models not in dropdownComfyUI not restartedrestart ComfyUI
"Unet Loader (GGUF)" node missingComfyUI-GGUF not installedManager → install ComfyUI-GGUF
Face/clothing changesperson not pinnedadd keep the person and clothing exactly the same
Background barely changesguidance too lowraise guidance to 3.0–3.5
Hard edge / "halo" around the personscene described too high-contrastname softer light ("soft diffused light"), steps to 20
Red nodes / errorsfile in the wrong foldercheck folders per the table above

Swapping a whole catalog? Use the cloud

A single photo renders in seconds on the RTX 3060. For a whole batch – an entire portfolio or product catalog into the same background – a cloud GPU pays off: an RTX 4090 (24 GB) from ~$0.59/h works through batches with no quant compromise. The full setup is in our hub:

👉 RunPod: rent a cloud GPU for ComfyUI

RunPodEmpfohlenes Tool · Cloud-GPU

Keine starke Grafikkarte? Führe ComfyUI in der Cloud aus.

Flux & SDXL sind speicherhungrig. Statt ~1.800 € für eine eigene Karte mietest du bei RunPod eine 24-GB-GPU ab ca. 0,50 €/Stunde – und zahlst nur, was du nutzt.

GPU mieten & Flux starten →Affiliate-Link · für dich ohne Mehrkosten

Conclusion & next steps

Flux Kontext isn't image generation, it's image direction: you keep your subject and swap the surroundings on purpose. The background swap is one of the strongest entry points – the same technique carries clothing, hairstyles and product variants.

One photo, one sentence – and the same person stands anywhere, without a single reshoot.