ComfyUI Node

BK Print Image

Send a generation to your actual physical printer

By JayLyu·Created 2 years ago·Updated about a year ago· 8
BK Print Image
  • image
  • PRINT_RESULT
triggerfalse
printer_name
output_folderprints
filename_prefixprint

Somewhere between "fun" and "why would anyone want this" sits BK Print Image: a node that takes the image currently in your graph, saves it to disk, and sends it to a real printer on your machine. Marked (BETA) by the author, supports Windows and macOS. It's the only node in the ComfyUI_BaiKong_Node pack that touches hardware outside your PC - and the one with the most surprising dependency situation.

How it works

Everything is gated by a boolean trigger input. Until you flip it to true, the node does nothing and returns "No print operation performed." - which is exactly how you want a "fire a physical object at you" node to behave. When triggered, it saves the first image of the batch as a PNG into ComfyUI's temp directory, then hands the file to the OS print path:

  • Windows - uses win32print, win32ui, and PIL's ImageWin to open a printer DC and draw the image scaled to 8.5×11 inches at the printer's DPI. With an empty printer_name it grabs the system default printer.
  • macOS - shells out to lpr (with -P printer_name if you set one), then polls lpstat for up to 60 seconds to report whether the job started or completed.
  • Anything else (Linux included) - returns "Unsupported operating system." Sorry, Linux.

The output is PRINT_RESULT, a status string telling you which temp file was sent, where it was saved, and the print status. The temp file naming is controlled by filename_prefix and the folder by output_folder (default prints), though for the actual print the file goes to the temp dir, not your output folder.

Inputs

  • image - what gets printed (first frame of the batch).
  • trigger - boolean gate; must be true to print.
  • printer_name - empty = system default.
  • output_folder / filename_prefix - naming for the temp save.

Install and the dependency trap

The pack itself installs normally:

cd ComfyUI/custom_nodes
git clone https://github.com/JayLyu/ComfyUI_BaiKong_Node
cd ComfyUI_BaiKong_Node
pip install -r requirements.txt

Restart ComfyUI, or search "ComfyUI_BaiKong_Node" in ComfyUI Manager. But here's the trap: the pack's requirements.txt does not include the Windows printing libraries. The Windows path imports win32print, win32ui, and PIL's ImageWin (from pywin32) at runtime, and if they're missing, printing fails with a traceback. On Windows you need to install that yourself:

pip install pywin32

macOS needs no extra Python deps - it relies on lpr and lpstat, which ship with the OS. If you're on Mac and printing silently fails, that's where to look first: those two commands need to exist on your PATH.

Gotchas

Because the node saves a temp copy on every triggered run, you'll accumulate print_XXXXX.png files in ComfyUI's temp directory - harmless, but it means this isn't a node you leave firing in a loop unattended. And treat the (BETA) tag seriously: the Windows path hardcodes a letter-size page, so your image will be scaled to 8.5×11 regardless of its own aspect ratio. If your output is square, expect it stretched to the page unless you pre-crop. Test it once with a cheap photo and you'll know exactly how your printer behaves.

Category⭐️ Baikong/Image

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
triggerBOOLEANfalse
printer_nameoptSTRING
output_folderoptSTRINGprints
filename_prefixoptSTRINGprint

Outputs (1)

NameTypeDescription
PRINT_RESULTSTRING