Nodes/S3 Connector/S3 Load Image
ComfyUI Node

S3 Load Image

Pull reference shots out of a bucket and straight into your graph

By haranesh·Created 7 months ago·Updated 5 months ago· 1
S3 Load Image
    • image
    • mask
    folder_path
    file_name

    S3 Load Image is the download half of the S3 Connector pack - the counterpart to S3 Upload Image. Instead of digging through input/ for a reference photo, it fetches a file from your S3 bucket and hands you a ready-to-use IMAGE tensor (plus a MASK). That's the setup for img2img, ControlNet, inpainting, or just compositing a file that lives in cloud storage. If you've got images that only exist in a bucket - maybe uploaded there by a previous run, or by another service entirely - this node is how you feed them back into a graph.

    How it works

    Mechanically it's boto3.get_object, same as everything else in the pack. It builds the S3 key as S3_PREFIX + folder_path + file_name, downloads the object, decodes it with Pillow, and normalizes it into a [1, H, W, C] float tensor. Nothing fancy, no caching, no local temp file - each execution pulls from the bucket fresh. It only loads a single image, so don't expect batch handling on the way in.

    Only two inputs, and both are plain strings:

    • folder_path (STRING) - subfolder in the bucket, e.g. references/. Blank means the file sits at the prefix root.
    • file_name (STRING) - the filename, image.png and friends. Required; an empty one is a hard error.

    Outputs are image (the IMAGE tensor) and mask (a MASK tensor). The mask behavior is worth knowing: if the downloaded PNG has an alpha channel, the node splits it out as mask = 1 - alpha (standard ComfyUI convention for compositing). No alpha means you get a zero-filled mask, which is exactly what a "nothing to mask here" signal should be. Wire image into a KSampler's latent, a ControlNet apply node, or whatever else takes an image.

    Installing and configuring

    It's part of the same pack, so installation is identical across all five nodes. Either ComfyUI Manager (search "S3 Connector") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/haranesh/comfyui-s3-connector
    cd comfyui-s3-connector
    pip install -r requirements.txt
    cp .env.example .env
    

    Fill in S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, and S3_BUCKET_NAME - all required. The .env file goes in the node's own directory, and it's loaded from there at import time. Leave S3_REGION at its us-east-1 default unless your bucket lives elsewhere, and set S3_ENDPOINT_URL only for S3-compatible services (MinIO, DigitalOcean Spaces, Cloudflare R2). Restart ComfyUI and you're done. Dependencies are boto3, python-dotenv, and Pillow - no heavy installs, no model downloads.

    Where people get burned

    The most common failure is a NoSuchKey error, which the node surfaces as "Image not found in S3: {key}". That usually means either the key is wrong or - sneakier - your S3_PREFIX doesn't line up with where the file actually is. Remember that the upload nodes apply the same prefix, so a file you pushed with folder_path="a" and prefix comfyui/ lives at comfyui/a/..., and loading it needs the same prefix configured. Also keep the RGB-only upload gotcha in mind: the upload side strips alpha, so images you round-trip through this pack will come back with a zero mask. If you need masks on the way out, upload PNGs with alpha from elsewhere.

    CategoryS3 Connector

    Inputs (2)

    NameTypeDefaultDescription
    folder_pathSTRING
    file_nameSTRING

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    maskMASK