Nodes/ComfyUI_Hangover-Utils/Image Clipboard Paster
ComfyUI Node

Image Clipboard Paster

Skip the drag-and-drop, paste straight into the graph

By Hangover3832·Created about a year ago·Updated 2 days ago· 1
Image Clipboard Paster
  • alt_image
  • alt_mask
  • IMAGE
  • MASK

Somewhere around the fiftieth "save a screenshot, drag it into ComfyUI, delete it later" you start to feel it. Image Clipboard Paster is the fix: copy an image anywhere on your system - a screenshot, a cropped face, a reference from a browser - and this node turns your clipboard into an IMAGE tensor (plus a MASK) the moment the graph runs. No temp file, no drag, no LoadImage browser. It's a small nicety, and it's exactly the kind of thing a pack from the ComfyUI_Hangover-Utils suite does well.

The catch, and it's a big one: this is the clipboard we're talking about, and the node is built on Pillow's ImageGrab.grabclipboard(), which only really works on Windows and macOS. The README admits it was tested on Windows 10 only. If you're on Linux, expect this node to error the moment it runs - plan for it, don't rage-post about it.

How it works

Two details make it feel magical. First, it implements IS_CHANGED by hashing the clipboard contents, so ComfyUI notices when you copy something new and reruns the node instead of serving you a stale cached image. Copy, hit Queue, done. Second, the code converts what it grabs to RGBA, drops the alpha channel into the IMAGE tensor, and derives the MASK output from that alpha: mask = 1 - alpha, so transparent pixels come out as 1. That's the inverse of what you might expect, and it's deliberate - wire that mask into a composite node and you can selectively reveal the original image underneath where the paste is transparent. Multiple images in the clipboard get batched into one tensor if they're the same size and format; different sizes throw a runtime error instead.

The inputs and outputs

  • alt_image and alt_mask - optional, and the node does not process them. They exist so that if you bypass the node (Ctrl+B), the image flow continues straight through rather than breaking the graph. In normal use you ignore them entirely.
  • Outputs: IMAGE and MASK. IMAGE feeds anything that takes an image - an img2img KSampler, a ControlNet preprocessor, an IP-Adapter reference. MASK feeds composite, inpaint, or detailer chains.

Install

ComfyUI Manager: search ComfyUI_Hangover-Utils, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Hangover3832/ComfyUI_Hangover-Utils

then restart ComfyUI. This node is what drags the Pillow dependencies in - the pack's requirements.txt includes pillow and pillow-avif-plugin (that last one adds AVIF support to Pillow, which is why AVIF clipboard images work at all). Manager installs them for you.

Common issues

  • "Clipboard does not contain valid image(s)!" - the classic. The clipboard has no image (or you're on Linux, where the grab returns nothing). Copy an actual image first.
  • "Pasting multiple images of different shape is not supported" - you copied several images at once and they don't match in size/format. Copy one at a time.
  • It won't pick up a new copy mid-session - the node only reruns when the graph is queued and the clipboard hash changed; copy, then queue.
  • Keep the alt_image path in mind if you build a workflow where the paster might be bypassed - that pass-through is what keeps the rest of the graph alive.
CategoryHangover

Inputs (2)

NameTypeDefaultDescription
alt_imageoptIMAGE
alt_maskoptMASK

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK