图片转URL(OSS)
The bridge that turns in-graph images into the URLs the image editor needs
- image
- mask
- image_url
- mask_url
Here's the thing nobody warns you about with API-based image editing: Alibaba's Wanx endpoint takes images as public URLs, not as tensors. So if you want to run the pack's "AI图片处理" node on an image that's sitting inside your ComfyUI graph - which is the normal case - you need to get that tensor into a URL first. That's this node's entire job: it uploads an IMAGE (and optionally a MASK) to an Alibaba Cloud OSS bucket and hands you back public URLs.
Plug an IMAGE into image, and image_url comes out. Plug a MASK into mask, and mask_url comes out. Feed those two strings into "AI图片处理"'s image_url and mask_url inputs, and the full local-image → cloud-edit loop works end to end. This is the node that makes the rest of the pack's image-editing story coherent, even though it's marked optional.
The inputs you'll set: bucket (the name of your OSS bucket, the tooltip spells it out), endpoint (an 18-entry dropdown of Alibaba regions, from 华东1(杭州) through Tokyo, Singapore, Seoul and Dubai - pick the region closest to your bucket), and the credentials. OSS_ACCESS_KEY and OSS_SECRET_KEY are optional because the node falls back to environment variables if you leave them blank. Outputs: image_url and mask_url.
Installing it is the one bit of this pack that isn't a two-click job. The node lives behind a try/except import - it only registers if the oss2 library is present, and oss2 is not in the pack's requirements.txt (it's listed as "可选 oss2" / optional). From the README:
pip install oss2
then restart ComfyUI. No oss2, no node - it silently doesn't appear in your node list, which has confused more than one person.
Setting up OSS, again from the README: create a bucket (Alibaba's tutorial link is in the pack README), turn off "block public access" and set read/write permissions to public-read - if your bucket isn't publicly readable, the URLs the node generates will 403 when the edit API tries to fetch them. Then grab an AccessKey ID + Secret from your Alibaba console and put them in the node (or in config.json / env vars).
Gotchas. The public-read requirement is the #1 failure: private buckets produce URLs that look right but die mid-request. Region mismatch is #2 - the bucket's region must match the endpoint you pick, or uploads fail. And if you leave the keys blank and didn't set env vars, uploads fail with an auth error that says nothing useful. Costs here are Alibaba OSS storage/bandwidth, which are pennies for test images but not literally zero.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| bucket | STRING | 请输入你创建的 Bucket 名称 | |
| endpoint | COMBO | 18 options: 华东1(杭州), 华东2(上海), 华东5(南京-本地地域), 华北1(青岛), 华北2(北京), 华北5(呼和浩特), +12 | |
| imageopt | IMAGE | — | |
| maskopt | MASK | — | |
| OSS_ACCESS_KEYopt | STRING | 未输入将从系统环境中获取 | |
| OSS_SECRET_KEYopt | STRING | 未输入将从系统环境中获取 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image_url | STRING | — |
| mask_url | STRING | — |