Nodes/Google Photos Loader - by PabloGFX/Google Photos Cache Manager πŸ—‘οΈ
ComfyUI Node

Google Photos Cache Manager πŸ—‘οΈ

Your photo cache is eating your disk β€” this is the trash can

By lazniakΒ·Created 2 years agoΒ·Updated about a year agoΒ· 3
Google Photos Cache Manager πŸ—‘οΈ
      β—„max_cache_size_mb5000β–Ί
      β—„clear_cachefalseβ–Ί

      The Google Photos Loader pack downloads your actual photos into ComfyUI, and by default it keeps them. Every image you pull through the Images Loader or Album Loader with cache_images on gets saved as a torch .pt tensor inside the pack's image_cache/ folder, named after the photo ID plus the exact size-option and target size you asked for. Do that across a handful of workflows and that folder quietly becomes a few gigabytes you forgot about. This node is the garbage can for that folder - which is exactly why its display name ends in a trash can emoji.

      What it does

      It's an output node: no wires out, you just drop it on the canvas and run it. Two knobs, and they're the whole node.

      • max_cache_size_mb (INT, 200–100000, default 5000) - the ceiling, in megabytes. 5000 is 5 GB.
      • clear_cache (BOOLEAN, default false) - flip this and it nukes the cache folder outright.

      The interesting bit is the default behavior. With clear_cache left off, the node acts as a size limiter: it measures the cache and only starts deleting when you're over the cap, removing oldest-modified files first until it's back under. So you can keep one in a workflow that touches lots of photos, set it to 2 GB, and never think about disk again. Flip clear_cache on and it just wipes the whole image_cache/ directory in one shutil.rmtree.

      Why you'd reach for it

      The loaders cache for a good reason - re-pulling the same photo from Google is slow, and .pt tensors reload in milliseconds. But the cache lives inside custom_nodes/comfyui-google-photos-loader/image_cache/, not anywhere you'd think to look, and nothing ever cleans it up. If you've been running photo-to-image or img2img workflows off your library for a while, go check the size of that folder. It's probably bigger than you think.

      Deleting cached files is always safe. They're derived data - the next time a loader asks for the same photo, it just downloads and re-processes it. The only real cost of a cache miss is a few seconds of network time.

      How to install it

      It ships with the pack, so installing the pack gets you this node:

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

      Or skip the terminal: open ComfyUI Manager β†’ Custom Nodes Manager, search "Google Photos Loader" (by PabloGFX), hit install, restart. No model downloads - this pack has none. It does pull the usual OAuth and image deps (aiohttp, google-auth-oauthlib, google-auth, Pillow, numpy), and it needs the Google Cloud setup the loaders require; the Login/Logout node article covers that one-time auth.

      Common gotchas

      • The cache is inside the plugin folder, so uninstalling the pack deletes your cache with it. If you're on a cloud instance with a small ephemeral disk, that also means the cache counts against that disk, not your main drive - set a tighter max_cache_size_mb.
      • Same photo, multiple cache entries. The cache filename encodes the size option, so one photo cached as "Crop to Size" and later as "Fill to Size" is two files. That's why the cache grows faster than you'd expect.
      • If the folder doesn't exist, the loaders never ran with caching on. The node logs "Cache directory does not exist" and moves on - that's fine, nothing's wrong.

      It's a boring node, honestly. But it's the one you'll thank yourself for installing the week your ComfyUI install refuses to start because the disk filled up with cached vacation photos.

      CategoryGoogle Photos

      Inputs (2)

      NameTypeDefaultDescription
      max_cache_size_mbINT5000200–100000β€”
      clear_cacheBOOLEANfalseβ€”

      Outputs (0)

      No outputs