ComfyUI-HappNodeSet
NODES: AutoCrop, ColorQuantizer, ExtractBlack, ExtractBlackAdvanced, RasterToUniformSVG, ... (10 total)
Nodes (21)
Trimming white space so your object actually fills the frame — before it hits a generator or a measure
Eight colors can fix a pixelated mess — and give you a palette worth stealing
A debug node that shows you the open ends before the gap closer goes to work
Reconnecting broken contours by their endpoints — with a direction check so it doesn't bridge the wrong things
Grab one value out of a comma-separated string — both as a float and as text
Turning dashed lines solid so the line detector stops seeing twenty fragments
The fastest way to get a clean black-on-white line drawing
When plain Extract Black isn't enough — luminance, saturation, and three output modes
Isolate the red markup, kill everything else — before anything else tries to read your diagram
How many holes are in this part? Now with annotations so you can argue with the answer
Plotting the shortest laser-head route through every hole and slot in your part
Counting the lines in a diagram — and drawing each one in its own color so you can check its work
A total line length you can actually defend — diagonal-aware, skeletonized, and reported in plain text
The bluntest instrument in the pack — and sometimes exactly what you need
Rescuing '52,25 €' and other human-typed numbers from text output
Raster to vector with uniform strokes — the node that makes pixelated diagrams worth scaling
Floor, as a node — because ComfyUI's rounding primitives don't always exist
Ceil, as a node — for when 'close enough' isn't a dimension you can cut
Paste an SVG, get its width and height — units converted to pixels so the numbers actually mean something
The true length of an SVG path — stroke width ignored, curves sampled properly
SVG path lengths without leaving ComfyUI — the laser cutter's cost-estimate node
ComfyUI-HappNodeSet
Custom nodes for ComfyUI
Installation
Method 1: ComfyUI Manager
Search for "HappNodeSet" in ComfyUI Manager and install.
Method 2: Manual Installation
cd ComfyUI/custom_nodes
git clone https://github.com/mikemojen/ComfyUI-HappNodeSet.git
Requirements
If you have specific Python dependencies, install them:
pip install -r requirements.txt
Nodes
ComfyUI Line Counter & Measurer
A ComfyUI custom node package that detects, counts, and measures straight/dashed lines in images.
Features
- Line Detection: Automatically detects all straight and dashed lines in an image
- Line Counting: Counts the total number of distinct lines
- Length Measurement: Measures each line's length in pixels
- 4-Way Junction Resolution: Intelligently handles crossing lines by pairing collinear segments
- Visualization: Creates a stitched image showing each line separately with its length
Algorithm
The node uses a sophisticated 7-step algorithm:
- Preprocessing: Grayscale → Binary threshold → Noise cleanup
- Skeletonization: Thin all lines to 1-pixel width
- Graph Building: Identify junction points and endpoints
- Junction Classification: Count connections at each junction
- 4-Way Junction Resolution: Pair collinear segments at crossings
- Line Extraction: Trace through graph following pairing rules
- Measurement & Export: Calculate lengths and generate visualizations
Installation
-
Clone or copy this folder to your ComfyUI
custom_nodesdirectory:cd ComfyUI/custom_nodes git clone <repo_url> comfyui_line_counter # OR cp -r /path/to/comfyui_line_counter ./ -
Install dependencies:
pip install -r comfyui_line_counter/requirements.txt -
Restart ComfyUI
Nodes
LineCounter (Basic)
Inputs:
image: Input image (IMAGE)threshold(0-255, default: 128): Binary threshold valuemin_line_length(1-1000, default: 10): Minimum line length to includenoise_removal_kernel(1-11, default: 3): Kernel size for noise removalangle_tolerance(5-90°, default: 30°): Tolerance for collinearity at junctions
Outputs:
line_count(INT): Number of detected linesline_lengths(STRING): Comma-separated lengths in pixelsvisualization(IMAGE): Stitched image of individual lines
LineCounterAdvanced
Same as basic, plus:
Additional Inputs:
dashed_line_gap(0-50, default: 10): Gap size to close for dashed linesline_thickness(1-10, default: 2): Line thickness in visualization
Additional Outputs:
skeleton_debug(IMAGE): Debug view showing skeleton with junctions (red) and endpoints (green)
Usage Example
- Add a "Load Image" node
- Connect it to "Line Counter & Measurer"
- Adjust parameters as needed:
- Lower
thresholdif lines are light colored - Increase
dashed_line_gapfor dashed lines with larger gaps - Adjust
angle_toleranceif lines at small angles should be separate
- Lower
- Connect outputs to preview nodes or save nodes
Input Requirements
- Image should have dark lines on a white/light background
- Lines should be relatively straight (not curved)
- Works best with clean, high-contrast images
Tips
- For dashed lines: Increase
dashed_line_gapto connect the dashes - For noisy images: Increase
noise_removal_kernel - For crossing lines: Adjust
angle_tolerance- lower values require more exact alignment - For thin/faint lines: Lower the
thresholdvalue
Example Workflow
[Load Image] → [LineCounter] → [Preview Image (visualization)]
↘ [Show Text (line_count)]
↘ [Show Text (line_lengths)]
License
MIT License
Usage
[Add usage examples]