Nodes/Google Photos Loader - by PabloGFX/Google Photos Album Loader ๐Ÿ–ผ๏ธ
ComfyUI Node

Google Photos Album Loader ๐Ÿ–ผ๏ธ

Load a whole Google Photos album into your graph as images

By lazniakยทCreated 2 years agoยทUpdated about a year agoยท 3
Google Photos Album Loader ๐Ÿ–ผ๏ธ
    • IMAGE
    โ—„album_idโ€”โ–บ
    โ—„max_images10โ–บ
    โ—„size_optionโ–พโ–บ
    โ—„target_size512โ–บ
    โ—„cache_imagestrueโ–บ
    โ—„client_secrets_file/tmp/ComfyUI/custom_nodes/comfyui-google-photos-loader/client_secrets.jsonโ–บ

    This is the payoff node of the Google Photos Loader pack: you hand it an album ID and it hands you actual image tensors, ready for img2img, style transfer, training-set assembly, or just turning your own photos into SD fuel. It's the end of a three-node chain - Album Lister dumps your albums, Album Selector turns them into a dropdown, and this is what finally pulls the pixels.

    How it works

    The node takes the album_id, authenticates with your saved Google token, and calls the Photos Library API's mediaItems:search endpoint with that album ID, paging through 100 items at a time until it hits max_images. It filters to PHOTO media type, so videos in the album are silently skipped. Each photo's download URL gets size parameters appended, the bytes come back over HTTP, get decoded with Pillow, converted to RGB, and turned into a torch tensor in the [B, H, W, 3] layout ComfyUI expects.

    Downloads run concurrently (the code caps it at 10 in flight), and with cache_images on, every processed photo is saved as a .pt tensor in the pack's cache so a second run is near-instant.

    The inputs that matter

    • album_id (STRING) - the opaque ID Google assigns the album, not the shareable link and not the title. Grab it from the Album Selector's output; pasting by hand is a pain but works.
    • max_images (INT, 1โ€“5000, default 10) - how many photos to load. Albums pull newest-first, so you're not getting a random slice.
    • size_option (enum: Original Size / Scale to Size / Crop to Size / Fill to Size) - this is where people get burned. "Scale to Size" resizes to fit target_size preserving aspect ratio, so images come out non-square. "Crop to Size" center-crops to an exact square. "Fill to Size" fits and pads with black bars to reach the square. If you're feeding a batch into a model that expects uniform square inputs, use Crop to Size - Scale gives you ragged dimensions and Fill gives you black bars that can confuse the model.
    • target_size (INT, 64โ€“2048, default 512) - the dimension the option above resizes toward.
    • cache_images (BOOLEAN, default true) - leave it on; turn it off only if disk is the problem.
    • client_secrets_file (optional STRING) - defaults to client_secrets.json in the pack's own folder. The default is right; don't touch it unless you keep your credentials elsewhere.

    Output: IMAGE, and importantly it's a list of images, not a single batch tensor. Wire it into nodes that accept image lists - a batch-join node, a per-image loop, or a loader that expects multiple images. A plain single-image input will choke on the list.

    How to install it

    cd ComfyUI/custom_nodes
    git clone https://github.com/lazniak/comfyui-google-photos-loader.git
    pip install -r requirements.txt
    # restart ComfyUI
    

    Or via ComfyUI Manager: search "Google Photos Loader" (by PabloGFX) โ†’ Install โ†’ restart. No model downloads. The one real prerequisite is the Google Cloud OAuth setup - enable the Photos Library API, create an OAuth desktop client, save it as client_secrets.json in the pack folder, and log in once. The Login/Logout node article walks that whole thing through.

    Troubleshooting

    • "No images found in album" in the console usually means the album ID is stale or wrong - re-run the Lister/Selector to grab the current ID.
    • Authentication errors are almost always a misnamed or misplaced client_secrets.json. The file must be named exactly client_secrets.json (with the "s" - the README is emphatic about this), sitting in the pack's directory.
    • Empty album returns an empty list, and whatever's downstream of you may not handle that gracefully. Worth knowing before you queue a whole batch.
    • The read is done through your token, which is scoped read-only - this node can look at your photos, never modify or delete them.
    Categoryloaders

    Inputs (6)

    NameTypeDefaultDescription
    album_idSTRINGโ€”
    max_imagesINT101โ€“5000โ€”
    size_optionCOMBO4 options: Original Size, Scale to Size, Crop to Size, Fill to Size
    target_sizeINT51264โ€“2048โ€”
    cache_imagesBOOLEANtrueโ€”
    client_secrets_fileoptSTRING/tmp/ComfyUI/custom_nodes/comfyui-google-photos-loader/client_secrets.jsonโ€”

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGEโ€”