This project implements a ComfyUI workflow for transforming input images into Van Gogh style paintings using Stable Diffusion and ControlNet. The workflow uses multiple ControlNet models and a depth map for enhanced control and detail preservation.
-
Clone the ComfyUI repository:
git clone https://github.com/comfyanonymous/ComfyUI.git
-
Navigate to the ComfyUI directory:
cd ComfyUI
-
Install the required Python packages:
pip install -r requirements.txt
-
Navigate to the custom_nodes directory:
cd custom_nodes
-
Clone the ComfyUI Manager repository:
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
-
Return to the ComfyUI root directory:
cd ..
-
Start ComfyUI:
python main.py
-
Open your web browser and go to
http://localhost:8188
-
In the ComfyUI interface, click on the "Manager" tab.
-
Search for and install the following custom nodes:
- CR Multi-ControlNet Stack
- CR Apply Multi-ControlNet
- CR String To Number
- CR Text
- DepthAnything_V2
- AnyLineArtPreprocessor_aux
- KSampler Adv. (Efficient)
Or alternatively click on "Install Missing Custom Nodes" in ComfyUI Manager Menu.
-
Install the following models:
- v1-5-pruned-emaonly.ckpt (Stable Diffusion v1.5)
- control_v11f1p_sd15_depth_fp16.safetensors
- control_v11u_sd15_tile_fp16.safetensors
- control_v11p_sd15_canny_fp16.safetensors (optional)
- control_v11p_sd15_lineart_fp16.safetensors
- depth_anything_v2_vitl_fp32.safetensors (This model will be automatically downloaded once Queue Prompt is clicked.)
-
Import the provided workflow JSON file into ComfyUI.
-
Load your input image using the "LoadImage" node.
-
Adjust the resolution in the "CR Text" node if needed.
-
Modify the positive and negative prompts in the "CLIPTextEncode" nodes to fine-tune the style transfer.
-
Click "Queue Prompt" to generate the Van Gogh style image.
The workflow consists of the following main components:
- Image Loading and Preprocessing
- Depth Map Generation
- ControlNet Processing (Tile, Canny, Lineart)
- Stable Diffusion Model with ControlNet Conditioning
- VAE Encoding and Decoding
- Advanced Sampling
Here are some sample results from the Van Gogh style transfer workflow:
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Original Image | Van Gogh Style
-
Missing Nodes: If you encounter missing nodes, make sure you've installed all required custom nodes using the ComfyUI Manager.
-
Model Loading Errors: Ensure all required models are downloaded and placed in the correct directory (usually
models/checkpoints
for Stable Diffusion models andmodels/controlnet
for ControlNet models). -
CUDA Out of Memory: If you encounter CUDA out of memory errors, try reducing the resolution in the "CR Text" node or use a GPU with more VRAM.
-
Unexpected Results: Fine-tune the prompts in the "CLIPTextEncode" nodes and adjust the ControlNet weights in the "CR Multi-ControlNet Stack" nodes to achieve desired results.
-
Performance: Workflow was designed to use multiple ControlNets. Based on your hardware, you can activate and deactive ControlNets. Workflow does not use the Canny Edge ControlNet but if needed it can be activated. It was placed during experimenting and was decided to leave it as an option.