Multiple Head Swap Flux.2-Klein
UPDATE v 3
I think it's really worth seeing :-)
The usual workflow has been completely turned on its head, at the cost of a minor inconvenience: you can perform head swaps on—say—up to 10 heads in the same image (and do it well), but you have to process them one at a time, then reload the image and continue with the next head.
This is because I decided to invert the mask and mask out all the heads that Klein should not swap during the current workflow pass.
On the plus side, thanks to this new strategy, the workflow operates with surgical precision.
Furthermore, several issues appear to have been brilliantly resolved:
1. Resolved the issue of color halos and lighting artifacts around stitched heads—which differed from the rest of the image—because the heads are no longer being stitched in.
2. Light and color correction has become superfluous because Klein constantly has a "visual" reference for almost the entire image.
3. Two or more heads attached one to another are no longer a problem, because by masking the heads Klein shouldn't see, all he has to do is swap to the correct one.
Plenty of Markdown notes on the inside with instructions and tips, but it's faster to do than to explain.
Have Fun
Update v 2
Improvements, new features, and workflow streamlining coming in the next few days!!
Sorry guys, I've seen some download already, please download it another time or remember to set the "mode" value of the Painter Flux Image Edit node to 4. My fault :-)
I've updated some nodes, manly using Painter Flux Image Edit instead of TextEncodeQwenImageEditPlus and grouped some nodes into subgraphs. Most of the time you don't even need refinement BUT it always improve colors an lightning as you can see in the images. The last image, for the hands of the alien I've used the Flux.2 Klein - v3 - Multi-Porpouse Image Editing - I2I - T2I. I've swapped the head of the man on the left background in a second round because he is really close to the woman.
If you load the images following the order of the swaps from left to right seems to me it's not necessary to modify the prompt. I see better results.
Enjoy it :-)
V1
This workflow is intended for head swaps involving fictional characters; it is a tool, so I am not responsible for how you use it.
It allows you to perform up to three simultaneous head swaps—provided the prompt is set up correctly—but if you are unable to complete all the necessary head swaps in a single session, you can simply reload the image and continue.
Models
I normally use flux.2-klein-9b-fp8.safetensors but if you use a gguf model change the model loader and connect it.
Recommended Loras download:
BSF – Best Face Swap page link:
https://huggingface.co/Alissonerdx/BFS-Best-Face-Swap/tree/main
or direct downloading link: https://huggingface.co/Alissonerdx/BFS-Best-Face-Swap/resolve/main/bfs_head_v1_flux-klein_9b_step3500_rank128.safetensors?download=trueRealism Slider V2: https://civarchive.com/models/2401004/realism-slider
Ultra Real v4: https://civarchive.com/models/2462105/ultrareal-krea2-klein9b?modelVersionId=2846977
The workflow should work with qwen image edit also, provided you have the right model, clip, vae and the correct bfs lora from the same huggingface page, you’ll probably have to change the load model node with a gguf one.
Please forgive me, I've forgotten one important thing: when you upload the base image containing the heads you want to change, you have to right-click on it and choose "Open in MaskEditor", then draw the mask over the face/faces and if needed over the skin you want matching color and tone. I've just updated the markdown notes inside :-)
Tips and tricks: this workflow provides three simultaneous head swaps. Theoretically we can add some more, but at a certain point you’ll encounter tecnical limits with the model, how many token he can handles without mixing facial features and so on, AND order matters: Always list your head replacements from left to right across the image. So it’s better after three headswap load again the last image generated, apply the next masks on the characters you have to swap, adjust the prompt and generate.
Note: if the heads of the base image are too close or touching, the mixing of somatic traits is guaranteed even when performing a single swap at a time.
If the head to be modified is in partial shadow relative to the body—such as in chiaroscuro images—it is advisable to also mask the hands, arms, or other body parts that the model will use as a reference for the face's skin color and tones, without needing to alter the prompt. I'll update the markdown notes soon.
Inside you will find markdown notes with tip and tricks, including color and tone matching of the skin.
In the provided images you can see the ones with and without color and tone skin of the arms and hands.
I'm sorry, but I don't have the experience to adapt it for use with graphics cards that have low VRAM; I have a card with 16 GB of VRAM and 32 GB of system RAM. If someone wants to modify it, that would be great!
Behave yourselves and don't break anything :-)
Description
Removed the color correction nodes, the inpaint crop and stitch nodes. Replaced the Qwen conditioning node with the excellent Painter Flux Image Edit node and updated the sampler to use a subgraph containing the standard settings for Flux models.
Now thank to an Invert Mask node, you just mask the heads you don't want to swap.
Precise and surgical, even when there are two heads attached one to another.
