Image To PIL
The bridge node for Pillow-based tools and ComfyScript
- images
- PIL_IMAGE
Most of the time you never touch this node, and that's fine - that's what it's for. ImageToPIL converts ComfyUI's native IMAGE type into a real PIL.Image object (Pillow's classic image class, the thing most Python image code, including a chunk of the wider Python ecosystem outside ComfyUI, is written against). You reach for it when something downstream specifically wants a PIL image instead of ComfyUI's own tensor - not when you're wiring together a normal graph of samplers, upscalers, and detailers.
The main reason it exists is the pack author's other project, ComfyScript: a Python front-end that lets you drive ComfyUI as a function library instead of dragging nodes around a canvas - write a few lines of Python, get an image back, no browser tab required. It's a real, actively-used tool in its own right, and its "real mode" runs actual Python objects between steps rather than routing everything through the node graph, which means it needs a way to hand you back a genuine PIL.Image rather than an opaque ComfyUI tensor. That's this node's job. PILToImage and PILToMask - its sibling nodes in this same pack - are the trip back the other way.
Outside ComfyScript, you'll still meet ImageToPIL if some other custom node pack declares an input typed PIL_IMAGE - a handful do, usually ones doing Pillow-specific work (drawing, EXIF metadata, palette tricks) that's much easier to write against PIL's own API than against a raw tensor. If you see a node with a PIL_IMAGE socket and a wire from a normal IMAGE output refusing to connect, this is the node that bridges them.
The inputs and outputs that matter
- images (IMAGE) - the only input, a standard ComfyUI image tensor, the same type every Load Image or Save Image node uses.
- Output: PIL_IMAGE - a custom type this pack defines. It only wires into sockets that specifically declare
PIL_IMAGE; it won't connect to a normalIMAGEinput, and nothing outside this pack (or something deliberately built to match it) will accept it.
How to install it
Via ComfyUI Manager: search "ComfyUI_Ib_CustomNodes" and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Chaoses-Ib/ComfyUI_Ib_CustomNodes
then restart. No extra dependencies to install - Pillow already ships as part of ComfyUI's own requirements, so this node isn't adding anything new to your environment, just exposing a conversion that was already possible under the hood.
Common issues & troubleshooting
"Why won't this connect to my normal image node?" This is the one that actually trips people up. PIL_IMAGE is not the same type as IMAGE, deliberately - ComfyUI's type system won't let you wire it into a socket expecting IMAGE, and the connection just refuses to attach. If that happens, either you grabbed the wrong output (you probably wanted the plain IMAGE from whatever produced it) or you need PILToImage on the receiving end to convert back.
You installed the pack and still don't have a use for this node. That's normal - most people never place it manually. It earns its keep inside ComfyScript scripts, or when a specific other pack demands a PIL_IMAGE input. If neither applies to you, ignore it and use the rest of the pack - the Load Image From Path nodes - without ever touching this one.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PIL_IMAGE | PIL_IMAGE | — |