Nodes/opencv-comfyui/OpenCV imshow_0
ComfyUI Node

OpenCV imshow_0

The node that pops a window on the server — and why that's a trap

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV imshow_0
  • mat
  • unknown
winname

imshow_0 does exactly what it says on the tin: it pops a GUI window on the machine running ComfyUI and displays the image you feed it, because that's what cv2.imshow(winname, mat) does. Two inputs - winname (a STRING, the window title) and mat (the NPARRAY to display) - and an output that is literally nothing (None).

Now the part you actually need to hear: this node is a trap in most setups, and ComfyUI already has a better way to look at an image. The built-in Preview Image shows the result in your browser, works headlessly, and doesn't depend on the server having a display. imshow_0 shows a window on the server's desktop. If ComfyUI runs on the same machine you're sitting at, with a real GUI session - and that GUI session is the one the server process can see - a window appears over there and you have to close it before the workflow can finish. That's not a preview; that's a modal interruption.

Where it's genuinely useful: debugging. When you're building a computer-vision pipeline in this pack and you want to eyeball an intermediate nparray as OpenCV renders it - with its true BGR order and channel interpretation - right at the point of a bug, a window on the local desktop is the fastest way to see what's actually in the buffer. That's a real workflow for someone iterating on, say, a mask or a spectrum. It's a debug tool, not a deliverable node, and it's never something you'd leave in a shared or remote workflow.

The headless gotcha. cv2.imshow needs a display. If ComfyUI runs on a headless server, in Docker, on Windows as a service, or anywhere without an accessible GUI session, the call fails - typically with an OpenCV error about cv::imshow / no display, or a crash of the node. There's no graceful fallback. If your ComfyUI isn't a desktop app you're actively watching, this node simply will not work for you. Don't put it in a workflow you'll run unattended; it will hang the run waiting on a window that no one will close.

Installing. ComfyUI Manager → search "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib

Restart ComfyUI; it's under image/OpenCV.

Which variant? imshow_0, imshow_1, and imshow_2 are three copies of the same cv2.imshow(winname, mat) call - the stub listed three overloads and the generator dutifully made a node for each. They're identical. Pick imshow_0 and forget the other two exist.

Bottom line. This is the one node in the pack to think twice about. For seeing your image, use Preview Image. For inspecting an intermediate buffer while debugging, on a machine with a display, imshow_0 is exactly the tool - just remember the window lives on the server, it blocks until you dismiss it, and it's the first thing you'll want to delete before you share the workflow with anyone else.

Categoryimage/OpenCV

Inputs (2)

NameTypeDefaultDescription
winnameSTRING
matNPARRAY

Outputs (1)

NameTypeDescription
unknownNone