jtydhr88 / ComfyUI-LayerDivider

ComfyUI LayerDivider is custom nodes that generating layered psd files inside ComfyUI
59 stars 8 forks source link

EN | 中文

ComfyUI LayerDivider

ComfyUI LayerDivider is custom nodes that generating layered psd files inside ComfyUI, original implement is mattyamonaca/layerdivider

image1 image2 https://github.com/jtydhr88/ComfyUI-LayerDivider/assets/860985/3ceb0638-1ed7-4e01-b231-03c4408c95e3

Environment

I tested the following environment, it might work on other environment, but I don't test:

Common

  1. Windows 10/Ubuntu
  2. GTX 3090
  3. Cuda 12.1

Env 1 - see Method 1

  1. ComfyUI embedded python (python 3.11) and ComfyUI Manager

Env 2 - see Method 2

  1. conda
  2. Python 3.11

Env 3 - see Method 3

  1. conda
  2. Python 3.11

Env 4 - see Method 4

  1. Ubuntu
  2. conda/Python 3.11
  3. cuda 12.1

(Common) Installation - CUDA & cuDNN

This repo requires specific versions of CUDA and cuDNN to be installed locally:

(Common) Installation - Visual Studio Build Tools

It might also require Visual Studio Build Tools. However, I am not sure because my local already installed previously. If it needs, you can find from Visual Studio Build Tools.

(Method 1) Installation - ComfyUI Embedded Plugin & ComfyUI Manager

  1. You could clone this repo inside comfyUI/custom_notes directly git clone https://github.com/jtydhr88/ComfyUI-LayerDivider.git
  2. or use ComfyUI Manager manager
  3. However, no matter which way you choose, it will fail at first time error
  4. Stop ComfyUI
  5. Then go to custom_nodes\ComfyUI-LayerDivider, and run install_windows_portable_win_py311_cu121.bat

Done!

(If you prefer to use conda and python 3.10, you could follow the next)

(Method 2) Installation - ComfyUI

You could use conda to manage and create the ComfyUI runtime environment:

Then you can run python -s ComfyUI\main.py --windows-standalone-build to check ComfyUI running properly.

(Method 2) Installation - ComfyUI LayerDivider

Then we can clone and configure this repo for ComfyUI:

Congratulation! You complete all installation!

(Method 3) Installation - ComfyUI LayerDivider

Assume you already have a conda python3.11 env

Congratulation! You complete all installation!

(Method 4) Ubuntu Installation - ComfyUI LayerDivider

Assume you already have a python3.11 env + cuda 12.1

Then make sure run them one by one:

Congratulation! You complete all installation!

Node Introduction

Currently, this extension includes two modes with four custom nodes, plus two layer modes(normal and composite) for each mode:

Mode

There are two main layered segmentation modes:

Layer Mode

Using in Divide Layer node to decide the layer mode:

Example workflows

Here are two workflows for reference:

Example outputs

Known issues

Sometimes, composite mode will fail on some images, such as ComfyUI example image, still under invesgating the cause

Credit & Thanks

My extensions for ComfyUI

My extensions for stable diffusion webui