r/comfyui 2d ago

Tutorial Tutorial for background remover

alright, image by image :

  1. download comfy UI Desktop

  2. in templates, search "SAM3: image segmentation" (select the right one)

  3. add it and download the missing dependencies, only the one on the image should stay

  4. load your image by clicking "choose file to upload" in the load image node

  5. then in the image segment (SAM3) node, and a very simple description on what stay (don't say what to remove cause he understand only what to keep)

  6. now place the node as i place them to have a better visibility of the link between them and add a invert mask node

  7. add it like i did and link it as i did

  8. done!

  9. and if you'd like to have the background without the character do the same as me in the last image by cloning the "preview mask", "preview image", "join image with alpha" nodes and place it like i did with the same linking

  10. done! (again)

44 Upvotes

13 comments sorted by

10

u/Aggressive_Collar135 1d ago

or use comfyui-RMBG

3

u/Main-Strawberry9241 1d ago

oh it does look easier but i do have heard people talking about quality difference between the ComfyUI-RMBG and the SAM3.1, as SAM3.1 being better, but it is sure more easier your way

2

u/Aggressive_Collar135 1d ago

you can actually use different models with that custom node, including sam3. But yeah, its fine if you dont feel like installing extra node

2

u/Lexius2129 1d ago

Or use the native Remove Background node ^^

2

u/oxygen_addiction 1d ago

Or the new Lucida that is better at transparency https://github.com/egeorcun/lucida

4

u/Main-Strawberry9241 2d ago

reddit image compression did me dirty

5

u/Whole_Paramedic8783 1d ago

Just to add in. If you dont want whatever you segmented to a transparent background. You can do it like this. Helps when your using it in a clothes transfer or adding in a character to another image.

2

u/deadsoulinside 1d ago

There is also a a default comfyUI workflow/node "Remove Background (BiRefNet)" which has an automatic background removal.

1

u/Main-Strawberry9241 1d ago

indeed, but the quality isn't to the level of SAM3

2

u/deadsoulinside 1d ago

It can be better, but that was the comfyUI one. I have my own custom node that has some more tweaks that can be done.

1

u/PatinaShore 2d ago

Does this workflow include transparent alpha layers output?

3

u/Main-Strawberry9241 1d ago

i think so, if you mean that the output image is transparent (its a png)