Nodes Browser

ComfyDeploy: How Batch Rembg for ComfyUI works in ComfyUI?

What is Batch Rembg for ComfyUI?

Remove background of plural images.

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for Batch Rembg for ComfyUI and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

batchImg-rembg

Rembg(Remove background) of image sequence for ComfyUI </br></br>

<img src = 'https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/d3e05963-b047-4900-aa58-10f1e1b0980c' width="400" height="400"></img> <img src = 'https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/bef5f8b4-3976-4c59-848f-7e77df6bd5a3' width="400" height="400"></img>

Installation

  1. Clone to your custom_nodes folder in ComfyUI:
git clone https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes.git
  1. Install rembg[gpu] (recommended) or rembg, depending on GPU support, to your ComfyUI virtual environment. E.g.:
pip install rembg[gpu]
pip install tqdm

batchImg-rembg workflows will often make use of these helpful node packs:


</br>

Workflow

for example,

<img src= 'https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/a516f83b-f149-45be-9dba-31c35c719f3b'>
</br> </br> </br> <img src = 'https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/17966afa-0b8a-4774-95d0-2c57b3846694'>

Optional Models(Choose according to your work, downloaded automatically)


All models are downloaded and saved in the user home folder in the .u2net directory.

The available models are:

<details open> <summary>Rembg Model Name </summary>

| Name | Description | Link | |--------|-------------------------------------------------------------------------------------|------------------------------------| | u2net(default) | A pre-trained model for general use cases. | download, source | | u2netp | A lightweight version of u2net model. | download, source | | u2net_human_seg | A pre-trained model for human segmentation. | download, source | | u2net_cloth_seg | A pre-trained model for Cloths Parsing from human portrait. Here clothes are parsed into 3 category: Upper body, Lower body and Full body. | download, source | | silueta | Same as u2net but the size is reduced to 43Mb. | download, source | | isnet-general-use | A new pre-trained model for general use cases. |download, source | | isnet-anime | A high-accuracy segmentation for anime character. | download, source | | sam(not recommended, not easy to use) | A pre-trained model for any use cases. | download encoder, download decoder, source |

</details> </br> </br>

Example

<table class="center"> <tr style="line-height: 0"> <td width=34% style="border: none; text-align: center">Original Image</td> <td width=33% style="border: none; text-align: center">LineArt before Rembg</td> <td width=33% style="border: none; text-align: center">LineArt after Rembg</td> </tr> <tr> <td width=34% style="border: none"><img src="https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/ef065506-e844-4b92-a282-d20198267f8e" style="width:100%"></td> <td width=33% style="border: none"><img src="https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/e4440bec-d6dd-4726-8200-c38facbd1130" style="width:100%"></td> <td width=33% style="border: none"><img src="https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes/assets/135937372/0d828694-1440-464b-9c68-7f646b73886f" style="width:100%"></td> </tr> </table> </br>

Acknowledgements

Thanks to rembg-comfyui-node for insight.</br> Thanks to rembg-comfyui-node-better for modifying repo.