Nodes/ComfyUI GCP Cloud Storage Integration/GCP Storage Download Image
ComfyUI Node

GCP Storage Download Image

Pull images straight out of a GCS bucket and into your workflow

By koirpraw·Created 10 months ago·Updated 10 months ago· 1
GCP Storage Download Image
    • image
    • filename
    gcs_pathgs://bucket-name/path/to/image.png

    You've got an image sitting in a Google Cloud Storage bucket and you want it inside ComfyUI - as a real IMAGE tensor, ready to feed into img2img, a ControlNet reference, or an IP-Adapter. That's exactly this node. It ships in the GCP Cloud Storage Integration pack (koirpraw/ComfyUI-GCP-storage-decouple), the one built around running ComfyUI on a cloud VM without treating the local disk as permanent.

    The pitch for this whole pack is decoupling storage from the box: models, inputs and outputs live in a bucket, and the VM holds a cache. If you're running on a GCP instance with a small boot disk - or on ephemeral/spot instances that get wiped when they die - this is the difference between "my workflow works" and "all my images just vanished with the instance."

    How it works: you hand it a full gs://bucket/path/to/image.png string. The node splits that into bucket + blob name, downloads the bytes with the google-cloud-storage client, decodes the image with PIL (converting to RGB if it isn't already), and converts it to the float tensor shape ComfyUI expects: (1, height, width, 3). Functionally it's a "Load Image" whose source is a bucket instead of your hard drive.

    The only input that matters is gcs_path - the full GCS path, and it must start with gs:// or the code raises a ValueError. Outputs:

    • image (IMAGE) - wires into anything that eats an image: VAE decode, a KSampler for img2img, ControlNet, ImageToMask, you name it.
    • filename (STRING) - the basename of the object, handy for naming or tagging things downstream.

    One honest caveat: unlike the pack's automatic mode, which caches model downloads locally, this node pulls the file fresh on every run. Big images over a slow uplink mean you watch the queue. Fine for reference images; less fun if you're fetching a 4K PNG on every single generation.

    Install via ComfyUI Manager (search "GCP Cloud Storage"; the pack title is "ComfyUI GCP Cloud Storage Integration"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/koirpraw/ComfyUI-GCP-storage-decouple
    

    then restart ComfyUI. Dependencies are the Google libraries - pip install google-cloud-storage google-auth google-auth-oauthlib google-auth-httplib2 (the pack's requirements.txt covers them). No models to download; the real setup is GCP-side: GCP_PROJECT_ID, GCP_STORAGE_BUCKET, and either GOOGLE_APPLICATION_CREDENTIALS (path to a service-account JSON) or GCP_CREDENTIALS_JSON. The repo's setup_gcp_storage.sh can create the bucket, service account, and folder structure for you if you have gcloud and gsutil installed.

    Troubleshooting here is almost always GCP auth, not ComfyUI:

    • google.auth.exceptions.DefaultCredentialsError - credentials env var is wrong or missing.
    • 403 Forbidden - the service account can't read; grant roles/storage.objectAdmin on the bucket.
    • 404 Not Found - wrong bucket name, or the bucket doesn't exist in your project.
    • ModuleNotFoundError: No module named 'google.cloud' - you skipped the pip install.

    And a word to the wise, given how custom nodes work in ComfyUI: this pack executes whatever's in its repo with your user account, and it reads real cloud credentials out of your environment. Keep the service account scoped to that one bucket, and don't expose a ComfyUI running this to the public internet without authentication.

    CategoryGCP Storage

    Inputs (1)

    NameTypeDefaultDescription
    gcs_pathSTRINGgs://bucket-name/path/to/image.pngFull GCS path (gs://bucket/path)

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    filenameSTRING