ComfyUI Node

None To 0

A safety net for empty branches

By mirabarukaso·Created 2 years ago·Updated 9 days ago· 206
None To 0
  • check_none
  • ret_img
  • ret_float
  • ret_int
  • ret_img
  • none_image
ret_float1.0000
ret_int1

None To 0 is a guard node. You give it something that might be None - the empty output of a branch that didn't fire - plus fallback values, and it hands you a clean, defined number (or image) instead of nothing. If the input is real, it passes it through; if the input is None, it substitutes your fallback. It's how you keep a graph from choking when an optional upstream node produces nothing.

This matters because ComfyUI branching is a little unforgiving. Some of Mira's own Logic and "74 family" gate nodes deliberately output None when their condition isn't met - a way of switching a branch off. But a lot of downstream nodes don't want None, they want a number or an image, and feeding them nothing gets you an error. None To 0 sits in the gap and normalizes it. It's part of ComfyUI_Mira, mirabarukaso's personal toolkit, and it's frankly a niche node - the author cheerfully calls it a "spoofing node" for messing with how other nodes behave, and notes the extra logic adds a little overhead ("but it's Python, so who cares?"). It only makes sense inside a graph that's using the pack's None-emitting gates.

How it works

It checks the check_none input. Not None? Every output passes the real thing through. Is None? The numeric outputs fall to 0, the image output becomes a tiny 2x2 placeholder so nothing downstream crashes, and none_image stays None for anything that specifically wants to know "there was nothing here." The fallback numbers you set are what get returned in the not-None case.

The inputs and outputs that matter

  • check_none - the possibly-None value (accepts any type).
  • ret_img - an IMAGE to pass through when the input is real.
  • ret_float / ret_int - the numeric values to return when the input is real (default 1).
  • Outputs: ret_float and ret_int (your values, or 0 when None), ret_img (your image, or a 2x2 placeholder when None), and none_image (pass-through, or None when None).

Installing it

ComfyUI Manager: search ComfyUI_Mira, install, restart. Or clone:

cd ComfyUI/custom_nodes && git clone https://github.com/mirabarukaso/ComfyUI_Mira.git

then restart. If it errors on load, run pip install -r requirements.txt in the ComfyUI_Mira folder. It's under Mira/Logic.

Common issues

  • It only makes sense with None-emitting nodes. If nothing in your graph deliberately outputs None, you don't need this. It's a companion to Mira's gate/switch nodes, not a general utility.
  • The 2x2 placeholder is intentional. When the input is None, the image output is a deliberately tiny stand-in so the graph keeps running - don't mistake a 2x2 image for a bug. If a later node needs real dimensions, branch on none_image instead.
  • Zero might be a valid value. The whole conceit is "None becomes 0," but if 0 is also a meaningful number downstream, you can't distinguish "was None" from "was genuinely 0." In that case route on none_image (which stays None) to tell them apart.
CategoryMira/Logic

Inputs (4)

NameTypeDefaultDescription
check_none*
ret_imgIMAGE
ret_floatFLOAT1.0000
ret_intINT1

Outputs (4)

NameTypeDescription
ret_floatFLOAT
ret_intINT
ret_imgIMAGE
none_image*