Nodes/ComfyGCS/Load Image from GCS
ComfyUI Node

Load Image from GCS

Pull images straight out of a GCS bucket instead of your input folder

By benmizrahi·Created about a year ago·Updated about a year ago· 1
Load Image from GCS
    • IMAGE
    gcs_input_prefix
    gcs_bucket
    gcs_project
    google_application_credentials_file

    If your source images live in a Google Cloud Storage bucket, Load Image from GCS is the node that skips the download-and-drop-into-input/ ritual. It's the read half of the ComfyGCS pack (the other half, Save Image to GCS, writes renders back up). Drop it in anywhere you'd use the stock Load Image - img2img, ControlNet preprocessors, IP-Adapter reference input - and the graph pulls its image from the bucket on every run instead of from your disk.

    It's a niche tool, let's be honest. Zero community chatter, near-zero search traffic, and if your images already sit on your own machine you don't need it. But if you're running ComfyUI on a box that gets its inputs provisioned remotely, or you're stitching ComfyUI into a pipeline where GCS is the shared file system, this is the missing link - no cron job syncing files, no gsutil cp before you render.

    How it works

    Every run, the node builds a google-cloud-storage client, downloads the object named in gcs_input_prefix to a local file under ComfyUI/input/, then decodes it with PIL exactly like the built-in Load Image: EXIF transpose applied, converted to RGB, alpha extracted into a mask. You get a standard IMAGE tensor out of it.

    One thing to notice: it re-downloads on every execution. No caching, no "only fetch if changed" logic. For one image per run that's fine; for batch loops against a big bucket, the repeated transfers will start to show in the egress bill.

    The inputs that matter

    • gcs_input_prefix - this is the full object key inside the bucket, filename included (e.g. prompts/figure.png). The node grabs the last path segment as the local filename, so it's really "path to the image in the bucket," not a directory.
    • gcs_bucket - your bucket name. Must already exist; nothing here creates buckets for you.
    • gcs_project - the Google Cloud project ID the bucket lives in.
    • google_application_credentials_file - optional path to a service account JSON key.

    The first three read their defaults from GCS_BUCKET and GCS_PROJECT env vars at node-creation time, so a lot of setups just type the bucket once in the shell and leave the node alone.

    Authentication - the actual gotcha

    Here's the trap the README doesn't warn you about. The code loads the service account file you point at, then... never passes those credentials to the storage client. It constructs storage.Client(project=...) with no credentials argument, which means it falls back to Application Default Credentials. The working setup is to set the standard GOOGLE_APPLICATION_CREDENTIALS env var to your service account key path and let ADC do its thing. The google_application_credentials_file field is basically decorative in the current code - a nice idea that didn't make it into the plumbing.

    And a second README-vs-code mismatch: the README says the project env var is GOOGLE_PROJECT_ID, but the node actually reads GCS_PROJECT. If you set the README's name, you'll get an empty default and a confusing error. Set GCS_BUCKET, GCS_PROJECT, and the standard GOOGLE_APPLICATION_CREDENTIALS.

    Installing it

    Search "ComfyGCS" in ComfyUI Manager and install, or clone it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/benmizrahi/ComfyGCS
    

    Restart ComfyUI. Manager pulls the pip deps (google-cloud-storage, google-auth, python-dotenv) automatically; on a manual install you'll need those in your ComfyUI Python environment. Like every custom node, you're running the author's code with your user account, so it's worth a glance at the repo before you hand it a service account key.

    Troubleshooting

    • DefaultCredentialsError / auth failures - ADC isn't set up. Export GOOGLE_APPLICATION_CREDENTIALS pointing at your service account key and restart ComfyUI.
    • FileNotFoundError or a 404 on download - the object key in gcs_input_prefix is wrong, or the bucket name/project combo doesn't match. Double-check the full path, not just the folder.
    • Nothing in the default fields - you're missing GCS_BUCKET/GCS_PROJECT env vars, or you set the README's GOOGLE_PROJECT_ID which the code ignores.

    It's a small, quiet pack with exactly two jobs. If one of those jobs is "read input images from Google Cloud Storage," this is the whole node. That's also the entire reason it exists.

    CategoryComfyGCS

    Inputs (4)

    NameTypeDefaultDescription
    gcs_input_prefixSTRING
    gcs_bucketSTRING
    gcs_projectSTRING
    google_application_credentials_fileoptSTRING

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE