Nodes/ComfyUI_S3_direct/Direct Load Image From S3
ComfyUI Node

Direct Load Image From S3

Start a workflow from an image that lives in S3, not in your input folder

By KunmyonChoi·Created 2 years ago·Updated 2 years ago· 0
Direct Load Image From S3
    • IMAGE
    • MASK
    s3_buckets3_bucket
    pathnamepathname for file
    region
    aws_ak
    aws_sk

    Say your input images live in an S3 bucket - a shared team bucket, or a pick from a pipeline you're not about to re-download by hand. The normal ComfyUI answer is to grab the file into ComfyUI/input and hope it doesn't get clobbered. Direct Load Image From S3 cuts that out: give it a bucket and a key, and it hands you the IMAGE and MASK tensors as if you'd loaded them from disk. It's the read-side sibling to this pack's Direct Save Image To S3.

    This is the least-seen of the three nodes in KunmyonChoi's ComfyUI_S3_direct (barely any impressions - which is a shame, because it's the one that makes a bucket usable as an input rather than just an archive). It's also the most faithful port of ComfyUI's own Load Image: same EXIF handling, same alpha-channel behavior, same truncated-image fallback. If you've ever stared at Load Image's inner workings, this will feel familiar.

    How it works

    The node calls client.download_fileobj(bucket, key, outfile) into an in-memory BytesIO buffer - nothing written to disk - then opens it with PIL using the same LOAD_TRUNCATED_IMAGES fallback the core Load Image node uses (so slightly-corrupt JPEGs won't hard-crash your run). It transposes EXIF rotation, walks multi-frame images, and, like core Load Image, turns the alpha channel into a MASK (inverted, so opaque = 0, transparent = 1). No alpha? You get an empty 64×64 mask tensor, same as core.

    Inputs and outputs

    Two required inputs:

    • s3_bucket - your bucket name (default "s3_bucket" is a placeholder).
    • pathname - the exact object key to fetch. There's no browser and no listing; this node is "load by key or fail." You have to know the key.

    Optional region, aws_ak, aws_sk for credentials. Outputs are IMAGE and MASK, both single tensors (not lists), and the node is not an output node - so it wires straight into any image input downstream: a VAE Encode, an Upscale Image, a ControlNet prep, whatever.

    Install and credentials

    One install for all three nodes in the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/KunmyonChoi/ComfyUI_S3_direct
    

    Restart ComfyUI after. ComfyUI Manager can do it - search "ComfyUI_S3_direct". The only real dependency is boto3 (torch is already there with ComfyUI); no models or heavy downloads.

    Credentials work the same as the pack's save nodes: environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) override the node fields, then the node fields, then boto3's default chain. Two gotchas from the source worth repeating: filling aws_ak without aws_sk silently falls back to the default chain, and there's no endpoint_url option - so MinIO, Cloudflare R2, and other custom-endpoint S3-compatible stores can't be reached by this pack. Real AWS, or bust.

    CategoryDirectS3

    Inputs (5)

    NameTypeDefaultDescription
    s3_bucketSTRINGs3_bucket
    pathnameSTRINGpathname for file
    regionoptSTRING
    aws_akoptSTRING
    aws_skoptSTRING

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK