English · Tiếng Việt
NH-Nodes for ComfyUI
76 production-focused nodes for ComfyUI: load and save image sets with their metadata, tile and composite large
images, pick the right resolution for current models and put results back into the original frame, refine masks,
segment garments and faces (also in half-body and group photos), mask the skin, hair, lips, teeth and clothes of people
by typing their names, get the mask of anything you name with SAM 3 from a short formula such as person - bag or
background, build VTON masks, route workflows with lazy switches, generate prompts, and test many LoRAs or models from
one node.
Every node is documented with a visual card, its inputs and outputs, and examples — in English and Vietnamese.
Highlights
Installation
ComfyUI Manager — search for NH-Nodes, install, restart ComfyUI.
Comfy CLI
comfy node install nh-nodes
Manual
cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
python -m pip install -r requirements.txt
Restart ComfyUI afterwards. Requirements: a recent ComfyUI (tested with 0.41) and Python 3.10+. SAM3 Segment and Body Segment have more requirements, listed below.
Optional: VTON and segmentation models
-
VTON Ultimate Processor needs ONNX Runtime, which is not installed automatically (the CPU wheel would overwrite an existing GPU build). Install one of them into ComfyUI's Python:
python -m pip install onnxruntime-gpu(NVIDIA) orpython -m pip install onnxruntime(CPU). -
Garment Segment, Portrait Segment, Body Segment and VTON download their models from Hugging Face on first use (pinned revisions, only the needed files): about 256 MB for Garment Segment, and 1.6 GB for Body Segment (3.3 GB and 5.9 GB for its larger sizes). Garment Segment, Portrait Segment and Body Segment also fetch YuNet, a 230 KB face detector (MIT) that runs on the CPU. Body Segment needs PyTorch 2.4 or newer. To keep models elsewhere, add these keys to
extra_model_paths.yaml:my_models: base_path: D:/ai-models/ nh_nodes: NH-Nodes/ # garment, face and body-part models, and the YuNet face detector vton_mask: ComfyUI-Vton-Mask/ # VTON pose + parsing ONNX models sam3: sam3/ # SAM 3 checkpoint (you download sam3.pt yourself) -
Image folders outside ComfyUI. Load Images Folder, Load images matching and Save Image Path work inside ComfyUI's
input,outputandtempfolders (saving:outputonly). To use a photo drive or a project folder, list it in the same file and restart ComfyUI (details):my_images: nh_image_folders: | D:/Photos/ E:/Exports/ -
Requirements for SAM 3 (SAM3 Segment only): an NVIDIA GPU with CUDA, Meta's
sam3package and thesam3.ptcheckpoint. NH-Nodes installs and downloads none of them: you install the package yourself and request the weights from Meta. The steps, and what to do if another SAM 3 pack is already installed, are in Before you start with SAM 3.
Quick start
| Goal | Chain | Guide |
|---|---|---|
| Upscale or refine a huge image piece by piece | Load Image → Image Tile → your sampler/upscaler per tile → Image Untile | image-compose |
| Generate at the model's native size, then restore the original framing | Load Image → NH Smart Ratio Image Resize → edit → NH Restore Image Geometry | resolution |
| Inpaint only the clothes | Load Image → Garment Segment → Mask Morphology (grow) → inpaint | vision |
| Mask the skin, hair, lips, teeth or clothes of the people in a photo by name | Load Image → Body Segment (regions: skin, hair, face or clothes - shoes; Vietnamese works: da, tóc, môi) → mask → retouch or inpaint |
vision |
| Mask every person, window or the sky in a large photo, or everything except the person | Load Image → SAM3 Segment (concepts: window, person - bag or background) → mask → edit or inpaint; add Segs Select to pick single instances |
vision |
| Compare many LoRAs, one per queue | Counter → Load LoRA Model Index (index) → sampler → Image Label (prints the LoRA name) → Save Image | loaders |
| Run one of two branches without executing the other | condition → If/Else (lazy) → … | logic |
Node catalog
| Group | Nodes | Guide |
|---|---|---|
| Image — load & save | Load Image Info, Load Images Folder, Load images matching, Save Image Path, NH Save Large Image | EN · VI |
| Image — compose | Image Tile, Image Untile, Image Grid Composite, Layer Layout Composite, Layer Stack Composite, Image Compare, Image Label, Image Resize Unit | EN · VI |
| Image — large preview | NH Large Image Preview, NH Large Image Compare, NH Large Preview Cache Manager | EN · VI |
| Image — mask-based retouch | NH Mask-Aware Resize, NH Agnostic Image Generator, NH Simple Face Paste | EN · VI |
| Resolution | NH Smart Resolution Picker, NH Smart Ratio Image Resize, NH Ratio Preset Image Resize, NH Remove Resize Padding, NH Restore Image Geometry | EN · VI |
| Mask | Mask Morphology, Mask Properties, NH Create Box Mask, NH Mask Aspect Ratio Match | EN · VI |
| Vision | Garment Segment, Portrait Segment, Body Segment, SAM3 Segment, Segs Select, Segs Compose, Segs To Masks, Segs To Impact SEGS, Segs Preview | EN · VI |
| VTON | VTON Ultimate Processor | EN · VI |
| Logic | Compare, Logic Gate, If/Else, Switch N, Any Switch, Any Branch Switch, Gate Switch, Value Match Index, Math Eval, Random Choice | EN · VI |
| Text | Prompt Template, Prompt Scheduler, String Operations, Prompt Join, Text Split, Regex Extract, Text Index, Text Concatenate, Text Split Lines, Text Random Line | EN · VI |
| Batch & lists | Batch Index, Batch Merge, Counter, List Create, List Index, List Filter, Any List Split | EN · VI |
| Loaders | Load LoRA Model Index, Load LoRA Clip Index, Load Diffusion Model Index, Load VAE Index, Load Clip Index | EN · VI |
| Utils | Multi-Slider (FLOAT/INT), Boolean Switch, Pack Universal, Unpack Universal, Universal Slider Builder (deprecated) | EN · VI |
All nodes live under NH-Nodes in the node menu; search by name or by node id (for example NH_ImageTile).
Documentation
- Guide: English · Tiếng Việt
- PDF guides: English · Tiếng Việt
- Changelog: docs/CHANGELOG.md — read it when updating: some fixes change outputs on purpose.
License
NH-Nodes' own code is MIT. Some features rely on third-party code or models with other terms — see THIRD_PARTY_NOTICES.md:
- VTON Ultimate Processor and Portrait Segment are for non-commercial use only (CC BY-NC-SA 4.0 code and parsing models; non-commercial face-parsing model).
- Garment Segment is for non-commercial use only, and NVIDIA's licence defines that as research or evaluation
purposes only: its default model (FASHN Human Parser) is under the NVIDIA Source Code License for SegFormer. The
other model,
fashionpedia, declares no licence but is fine-tuned from NVIDIA'smit-b3, so treat it the same way. - Body Segment uses Meta's Sapiens2 under the Sapiens2 License: royalty-free, with no non-commercial clause, but it prohibits surveillance, biometric processing, identifying people, deepfakes and other uses, requires you to follow privacy, biometric and trade-control laws, and lets Meta audit your use, end the licence and change its terms. The model code is included with its licence; the weights are downloaded from Meta's Hugging Face repositories.
- SAM3 Segment uses Meta's SAM 3 under the SAM License: royalty-free, with no non-commercial clause, but it bars
military or warfare, nuclear, espionage, and gun or illegal-weapon uses. The weights and the
sam3package are not included; you get them from Meta.
Development
-
Layout:
core/holds shared helpers and model backends (no nodes);nodes/<category>/mirrors the menu, and every module there that definesNODE_CLASS_MAPPINGSis registered automatically;web/holds the frontend extensions. -
Tests and lint (run from the ComfyUI root / the pack folder):
python -m pytest custom_nodes/NH-Nodes/tests -q ruff check . -
Docs assets are generated from the live code:
docs/_tools/build_node_cards.py(node cards) anddocs/_tools/build_examples.py(example images), both run from the ComfyUI root.
Author
jetthuang.com · Hugging Face · Support via PayPal. If NH-Nodes helps your work, a ⭐ on GitHub is appreciated.






