Image to URL
Turn an image into a URL you can paste anywhere
- image
- url
Ever needed to hand an image you just generated to something that only accepts a URL - an image API, a chat model, a webhook, a browser? Image to URL converts an IMAGE tensor into a URL string. One output, and depending on the mode you pick, that string is either a self-contained data URL or a link to an uploaded copy. It's the glue between "I have pixels" and "this API wants a URL."
The three modes
- data - embeds the image as a base64
data:URL. Self-contained, no network, works offline, and the string is enormous (a 1024px PNG is a megabyte-plus of base64). Fine for local tools and chat models that accept data URLs; miserable for anything with URL length limits. - kefan - uploads the image to
ai.kefan.cn's upload endpoint and returns the hosted URL. Short, shareable, requires network. It's a third-party Chinese image-hosting service - the pack author's own choice of upload backend, so this is the mode that leaves your image on someone else's server. - auto (default) - tries kefan first, and silently falls back to a data URL if the upload fails. Convenient, but it means your workflow's behavior depends on network availability and a third-party API.
The inputs
- image - the tensor to convert. Batches produce one URL per image, joined by newlines.
- mode - one of the three above.
- timeout - upload timeout in seconds, 5-300, default 30. Only matters in
kefanandautomodes.
Output: url, a STRING.
When you'd reach for it
The genuinely useful pattern is API feeding: generate an image, convert it, paste the URL into a vision-capable model call or a remote service that wants to see what you made. In data mode it's also a decent way to stash a preview into a text field or a log without touching disk. But read that third-party caveat before you point it at anything sensitive - kefan and auto both upload your pixels off-machine.
Installing it
ComfyUI Manager, search "ComfyUI 1hewNodes", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Pack note: this node needs requests (in the repo's requirements), but the install's heavier stuff - rembg, ultralytics, transformers - is irrelevant to it.
Gotchas
The data-URL size is the one that bites people: paste a data mode output into a URL field and you'll often find it truncated or rejected. And in auto mode, an offline workflow that "worked yesterday" will silently switch to data URLs - the node won't tell you which mode it used, so if a downstream API suddenly rejects your output, check the URL prefix. data: means it fell back.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | auto | 3 options: auto, kefan, data |
| timeout | INT | 305–300 | — |
| imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| url | STRING | — |