Nodes/Comfyui_wan_api/WanAPI图片上传
ComfyUI Node

WanAPI图片上传

Your Image Needs a Public URL Before Wan's API Will Look at It

By penposs·Created 2 years ago·Updated about a year ago· 2
WanAPI图片上传
  • images
  • STRING
upload_method
github_repo
github_branchmain
github_token

WanAPI_ImageUploader is the plumbing node of this pack, and it exists because of a quirk in how the DashScope I2V API works: it doesn't take pixels, it takes an image URL. The sibling WanAPI_Image2Video node asks for an image_url, and someone has to produce a public link to your starting frame. This node is that someone - it turns a ComfyUI IMAGE tensor into a URL hosted on GitHub's raw CDN.

How it works

Mechanically it's simple. The node takes the first image of your batch, converts the tensor to a PIL image, saves it as a JPG (quality 95) in a temp folder, then base64-encodes it and PUTs it to your repo at images/wanx_<timestamp>.jpg through the GitHub contents API. The output is https://raw.githubusercontent.com/<repo>/<branch>/images/<file> - a plain, publicly fetchable URL, which is exactly what the cloud model needs to animate that first frame. Temp files get cleaned up after upload, and a cleanup_github.py helper plus a keep=10 auto-prune stop the repo from filling up with frame jpgs.

The inputs that matter

  • images - the IMAGE tensor, straight from LoadImage or anything that produces one. Only the first frame of a batch is uploaded, so don't expect 12 images in to mean 12 URLs out.
  • upload_method - GitHub or ModelScope. Here's the trap: ModelScope is listed as an option, but the node's actual upload path raises "unsupported upload method" for anything except GitHub. Pick GitHub.
  • github_repo / github_branch / github_token - per-node overrides. Leave them empty and it reads GITHUB_REPO, GITHUB_BRANCH, and GITHUB_TOKEN from config.json in the pack folder.

The single output is a STRING - the public URL. Wire it into WanAPI_Image2Video's image_url input and you're done.

The one-time setup

You need a GitHub personal access token with the repo scope and a public repo - raw.githubusercontent URLs only resolve for public repos, and a private one breaks the whole chain. The pack ships setup_github.bat / setup_github.py to walk you through creating the token, or you can do it by hand at github.com/settings/tokens/new and paste the values into config.json.

Common issues

A 403 with "resource is not accessible" means the token lacks write permission or the repo isn't one it can write to - the node prints exactly that hint. Failed uploads usually mean network trouble or a token with the wrong scope. And because this is a batch pack, GitHub's API rate limits will bite if you hammer it with hundreds of uploads in one session.

Install is the same as the rest of the pack - it's one repo:

cd ComfyUI/custom_nodes
git clone https://github.com/penposs/Comfyui_wan_api.git

or grab it via ComfyUI Manager and search "Comfyui_wan_api". The node itself is dependency-light, but the code imports modelscope while requirements.txt forgets to list it - if the pack won't load, pip install modelscope fixes it.

Honest take: it's a utility node with a dirty job - exposing your generated frame on the public internet so a cloud API can read it back. You could skip it and hand Image2Video any URL you already have, but if your images live inside ComfyUI, this is the path of least resistance. Just keep that repo public.

CategoryWanAPI

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
upload_methodCOMBO2 options: GitHub, ModelScope
github_repooptSTRING
github_branchoptSTRINGmain
github_tokenoptSTRING

Outputs (1)

NameTypeDescription
STRINGSTRING