π¨ Qwen Image 2512 + SAM3 Face Inpainting Workflow
> Generate stunning portraits with automatic face detail enhancement β using single prompts or batch scheduling.
## β¨ What This Workflow Does
This ComfyUI workflow combines Qwen Image 2512 (a powerful text-to-image model) with SAM3 Smart Inpainter to:
1. πΌοΈ Generate high-quality images from text prompts
2. π€ Automatically find and enhance faces (man + woman) using AI segmentation
3. π Support single prompt OR batch prompt scheduling for creative variations
4. β‘ Speed up generation with CacheDiT acceleration
5. π― Use advanced sampling for better results
Perfect for: character portraits, fashion shoots, story illustration, face refinement, and creative batch generation.
## β¨ What's New in V1.1
### π Auto-Reset Counter (No More Manual Reset!)
- Replaced the old PrimitiveInt node with my new AutoResetInt node
- β
Automatically resets to 0 after each generation
- β Also resets if you cancel a generation
- β Want to run multiple batches? Just wait for the first image to finish β the counter resets itself!
- π― No more forgetting to reset β just click "Queue" and go
### βοΈ Model Format Switch
- Added a simple toggle to choose your model format:
- GGUF β for lower VRAM / quantized setups
- FP8 / BF16 β for full quality on powerful GPUs
- π― Pick what works best for your hardware β no need to edit the workflow
## π¦ Required Custom Nodes
Install these in your ComfyUI/custom_nodes/ folder:
| Node Pack | Purpose | Link |
|-----------|---------|------|
| RES4LYF | Advanced sampler with better quality control | https://github.com/ClownsharkBatwing/RES4LYF |
| SAM3_SmartInpainter | Auto-detect & inpaint faces using SAM3 | https://github.com/majidfida/SAM3_SmartInpainter |
| ComfyUI-CacheDiT | Speed up Qwen Image generation | https://github.com/Jasonzzt/ComfyUI-CacheDiT |
| comfyui_auto_prompt_schedule | Run multiple prompts in one batch | https://github.com/ReinerBforartists/comfyui_auto_prompt_schedule |
### Also Required:
- ComfyUI-Easy-Sam3 or ComfyUI-RMBG (provides the sam3 Python package for SAM3_SmartInpainter)
- Qwen Image model files: qwen_image_vae.safetensors, qwen_2.5_vl_7b_fp8_scaled.safetensors, and your chosen checkpoint (e.g., Qwen-Overcooked_fp8_V2.safetensors)
- SAM3 model: Download sam3.pt from https://huggingface.co/Majidfida/Sam3/tree/main β place in ComfyUI/models/sam3/
## π§ How to Use
### Step 1: Install & Setup
1. Clone all required node packs into custom_nodes/
2. Install Python requirements (see each repo's README)
3. Download models and place them in correct folders
4. Restart ComfyUI
### Step 2: Load the Workflow
1. Drag the .json file into ComfyUI
2. Wait for nodes to load (missing nodes will show red)
### Step 3: Choose Your Mode
#### π― Single Prompt Mode (Default)
- Set the toggle true=Single Prompt | false=Batch Prompts β true
- Edit the prompt in the β‘Single Promptβ‘ node
- Click Queue Prompt
#### π Batch Prompt Mode
- Set the toggle β false
- Edit prompts in the Input Prompts for Schedule node (format: "0": "prompt text", "30": "next prompt", ...)
- Set max_frames in PromptSchedule node to control how many to generate
- Click Queue Prompt β it will auto-run through your list
### Step 4: Face Inpainting (Automatic)
The workflow automatically:
1. Finds the woman's face β enhances it with prompt: "woman, exquisite detailed face..."
2. Finds the man's face β enhances it with prompt: "man with dark beard, exquisite detailed face..."
3. Blends both back into the main image
π‘ Tip: To inpaint different subjects, chain more SAM_SmartInpainter nodes and change the prompt field (e.g., "hat", "eyes", "scarf").
### Step 5: Adjust Key Settings
| Parameter | Recommended | What It Does |
|-----------|-------------|--------------|
| min_mask_area | 0.001 | Allows tiny faces to be detected |
| crop_padding | 32β128 | Extra space around face for better inpainting |
| inpaint_resolution | 1280 | Higher = more detail in repainted face |
| denoise | 0.3β0.5 | Lower = subtle changes, higher = more creative |
| steps | 6 | Qwen Image works well with low steps |
| cfg | 1.0 | Keep low for Qwen Image |
---
## π‘ Pro Tips
πΉ Small or distant faces not detected?
β Lower min_mask_area to 0.0005 and text_threshold to 0.25
πΉ Inpainting looks blurry?
β Raise inpaint_resolution to 1280 or 1536
πΉ Edges look harsh?
β Use blend_mode: feather and increase mask_blur
πΉ Want to inpaint more than faces?
β Change the SAM prompt to "hat", "logo", "hands" β it will find and repaint that area
πΉ Batch generation too slow?
β Enable CacheDiT and use fp8 models for faster runs
## β οΈ Important Notes
πΈ This workflow is designed for Qwen Image 2512 β other models may need parameter adjustments
πΈ I do not monitor this post β I may not reply to comments or issues. This is shared for the community to use and improve.
πΈ Always test with one image first before running large batches
---
## π Credits
- Qwen Image 2512 β Alibaba Cloud / Qwen Team
- SAM3 Model β Meta AI Research / Majidfida (HuggingFace)
- RES4LYF β @ClownsharkBatwing
- SAM3_SmartInpainter β @majidfida
- CacheDiT β @Jasonzzt
- Auto Prompt Schedule β @ReinerBforartists
> π¨ Simple rule: Start with single prompt β get it perfect β then try batch mode for variations.
> If faces aren't found β lower min_mask_area. If results look soft β raise inpaint_resolution.
Happy creating! β¨π«πΌοΈ
Description
## β¨ What's New in V1.1
### π Auto-Reset Counter (No More Manual Reset!)
- Replaced the old PrimitiveInt node with my new AutoResetInt node
- β
Automatically resets to 0 after each generation
- β Also resets if you cancel a generation
- β Want to run multiple batches? Just wait for the first image to finish β the counter resets itself!
- π― No more forgetting to reset β just click "Queue" and go
### βοΈ Model Format Switch
- Added a simple toggle to choose your model format:
- GGUF β for lower VRAM / quantized setups
- FP8 / BF16 β for full quality on powerful GPUs
- π― Pick what works best for your hardware β no need to edit the workflow
---
## π§© What This Workflow Does
1. πΌοΈ Generate high-quality images from text using Qwen Image 2512
2. π€ Automatically find faces using SAM3 AI
3. π¨ Repaint only the face area for extra detail
4. π Support single prompts OR batch prompt scheduling
5. β‘ Speed up with CacheDiT acceleration
Perfect for: couple portraits, character art, face refinement, fashion shoots, and creative batch generation.
---
## π¦ What You Need to Install
### Required Custom Nodes:
| Node | Purpose | Link |
|------|---------|------|
| AutoResetInt | Auto-resetting counter (NEW!) | https://github.com/majidfida/AutoResetInt |
| SAM3_SmartInpainter | Auto face detection + inpainting | https://github.com/majidfida/SAM3_SmartInpainter |
| RES4LYF | Advanced sampler for better quality | https://github.com/ClownsharkBatwing/RES4LYF |
| CacheDiT | Speed up Qwen Image generation | https://github.com/Jasonzzt/ComfyUI-CacheDiT |
| Auto Prompt Schedule | Run multiple prompts in one batch | https://github.com/ReinerBforartists/comfyui_auto_prompt_schedule |
### Also Required:
- ComfyUI-Easy-Sam3 or ComfyUI-RMBG (provides the sam3 Python package)
- Qwen Image models: qwen_image_vae.safetensors, qwen_2.5_vl_7b_fp8_scaled.safetensors, and your chosen checkpoint
- SAM3 model: Download sam3.pt from https://huggingface.co/Majidfida/Sam3/tree/main β place in ComfyUI/models/sam3/
---
## π§ How to Use (Super Simple)
### Step 1: Install & Setup
1. Clone all required nodes into ComfyUI/custom_nodes/
2. Install Python requirements (see each repo's README)
3. Download models and place them in the correct folders
4. Restart ComfyUI
### Step 2: Load the Workflow
- Drag the .json file into ComfyUI
- Wait for nodes to load (missing nodes will show red)
### Step 3: Pick Your Settings
| Setting | What to Do |
|---------|------------|
| Model Format Switch | Choose GGUF (low VRAM) or FP8/BF16 (high quality) |
| Prompt Mode Toggle | true = single prompt, false = batch prompts |
| SAM Prompt | Type what to enhance: "woman face", "man beard", etc. |
| min_mask_area | Lower to 0.001 if faces are small or far away |
| inpaint_resolution | Keep at 1280 for sharp face detail |
### Step 4: Generate!
- Click Queue Prompt
- Watch the magic happen β¨
- For batch mode: edit prompts in the schedule node and set max_frames
---
## π‘ Pro Tips
πΉ Small faces not detected?
β Lower min_mask_area to 0.0005 and text_threshold to 0.25
πΉ Inpainted face looks blurry?
β Raise inpaint_resolution to 1280 or 1536
πΉ Edges look harsh?
β Use blend_mode: feather and increase mask_blur
πΉ Want to inpaint more than faces?
β Change the SAM prompt to "hat", "eyes", "hands" β it will find and repaint that area
πΉ Running multiple batches?
β Just wait for the first image to finish β AutoResetInt resets itself automatically!
---
## β οΈ Important Notes
πΈ SAM3 only β This workflow has only been tested with sam3.pt
πΈ I do not monitor this post β I may not reply to comments or issues. This is shared for the community to use and improve.
πΈ Always test with one image first before running large batches
πΈ GGUF vs FP8: GGUF uses less VRAM but may have slightly lower quality. FP8/BF16 gives best results if your GPU can handle it.
---
## π Credits
- Qwen Image 2512 β Alibaba Cloud / Qwen Team
- SAM3 Model β Meta AI Research / Majidfida (HuggingFace)
- AutoResetInt β @majidfida
- SAM3_SmartInpainter β @majidfida
- RES4LYF β @ClownsharkBatwing
- CacheDiT β @Jasonzzt
- Auto Prompt Schedule β @ReinerBforartists
---
> π― Simple rule: Start with one prompt β get settings perfect β then try batch mode.
> If faces aren't found β lower min_mask_area. If results look soft β raise inpaint_resolution.
Happy creating! πΌοΈβ¨π«







