从oss加载图片
Pull images out of an Alibaba OSS bucket and straight into your graph
- IMAGE
Ever wished the input image for your workflow lived in an Alibaba Cloud OSS bucket instead of a folder on disk? That's the entire job of this node. It's the "read" half of the nxt5656/image2oss pack - no model, no GPU work, just a small HTTP client that reaches into your bucket, grabs one object, and drops it onto the canvas as a normal IMAGE tensor that everything downstream can consume.
That sounds niche until you've built an automated pipeline: images generated on one machine, uploaded to shared storage, and a ComfyUI worker somewhere else that needs to pick them up and run img2img on them. Or you keep your reference library in a bucket and want to skip the download step entirely. Either way, this node replaces "manually move the file into input/" with a wire.
How it works
Under the hood it uses the oss2 Python SDK with StsAuth (Alibaba's signature v2 auth), opens the bucket, and calls get_object() with the key you give it. The bytes come back, get decoded by Pillow, converted to RGB, and normalized to the 0–1 float tensor shape ComfyUI expects. Note that uploads in this pack are always PNG, but loading works on whatever you stored.
The inputs that matter
Four of the six fields do the real work:
filename- the full object key in the bucket, including any folder prefix.tmp/screenshot.pngmeans the object literally namedtmp/screenshot.png, not a file calledscreenshot.pngsomewhere in atmpfolder.access_key_id/access_key_secret- your long-lived Alibaba Cloud keys. This is the direct-auth version of the pack.security_token- leave this empty unless your keys are STS-style temporary credentials.bucket_nameandendpoint- bucket + region.endpointis a dropdown of 44 Alibaba regions, and the node'sVALIDATE_INPUTSrejects anything that isn't one of them, so don't hand-type a custom endpoint.
The one output is IMAGE, wired to whatever needs the picture - VAE encode, a ControlNet preprocessor, an img2img sampler, anything that takes an image tensor.
Install
ComfyUI Manager (search "image2oss"), or comfy node registry-install image2oss, or the old-school route:
cd ComfyUI/custom_nodes
git clone https://github.com/nxt5656/image2oss
Then restart ComfyUI. The only dependency that isn't already in a stock ComfyUI is oss2, which the pack's requirements.txt installs (oss2, numpy, requests, pillow, torch). No model files, no heavy downloads - the pack does bundle a 16MB CJK font, but that's only used by the watermark nodes, not this one.
Where people get burned
- The key in the workflow file. Your AK/SK live in the node widgets, which means they're saved into the
.jsonof any workflow you save. Email a workflow with real keys in it and you've handed over cloud credentials. This is the standard caution for any node that carries credentials (the KB's external-api-nodes doc hammers this exact point). Use the STS-service variants of this pack if the workflow might leave your machine. - Wrong object key - the classic failure.
get_objecton a key that doesn't exist raisesNoSuchKeyand the error you'll see names the object and bucket, which makes it easy to spot a missingtmp/prefix or a typo'd folder. - Endpoint mismatch. Region dropdown says one thing, your bucket actually lives in another - fix the dropdown, don't type around it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| filename | STRING | tmp/screenshot.png | — |
| access_key_id | STRING | access_key_id | — |
| access_key_secret | STRING | access_key_secret | — |
| security_token | STRING | — | |
| bucket_name | STRING | bucket_name | — |
| endpoint | COMBO | oss-cn-hangzhou.aliyuncs.com | 44 options: oss-cn-hangzhou.aliyuncs.com, oss-cn-shanghai.aliyuncs.com, oss-cn-qingdao.aliyuncs.com, oss-cn-beijing.aliyuncs.com, oss-cn-shenzhen.aliyuncs.com, oss-cn-heyuan.aliyuncs.com, +38 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |