Google Image Search
One query, one image tensor, one API key
- IMAGE
This node answers a surprisingly common itch: you want a real image in the middle of a ComfyUI graph - a photo of a building, a reference still, a texture you can't prompt into existence. GoogleImageSearchNode takes a search query, calls Google's image search, and hands you the top result as a normal IMAGE tensor. It's one of the few nodes where the Reddit use case actually matches the name: people recommend it for "look up how the Kiyomizu-dera temple actually looks, then generate a photo of it," piping the result into something like IP-Adapter or a reference-conditioned model.
One thing to get out of the way, because it surprises people: this is not a scraper and it's not "free" in the no-setup sense. It hits the Google Custom Search JSON API, which means you need two credentials before the node does anything - an API key and a Custom Search Engine ID. Free tier gives you 100 searches a day. The red 64×64 image you get when you haven't configured anything is the node's way of saying "go read the README," not a bug.
How it works
On execution the node reads config.json from its own install folder, builds a customsearch v1 client with your API key, and fires cse().list(q=search_query, cx=search_engine_id, searchType='image', num=1, safe='off'). So: one query, num=1, exactly one result. It grabs that result's link, downloads it with requests (10-second timeout), converts it PIL → RGB → float32/255, and returns a [1, H, W, C] tensor. No model files, no heavy downloads - the whole pack is a single node.py. Dependencies are the Google client libraries plus the usual ComfyUI stack (torch, numpy, Pillow, requests), so there's nothing GPU-weighty hiding in here.
Any failure - bad key, dead image host, quota hit - lands in the same except block and returns that solid red tensor. Your workflow keeps running; you just get a loud red square instead of an image.
The inputs that matter
The info_schema is refreshingly small:
- search_query (STRING, default
"cat") - the only input. Type whatever you'd type into Google Images. Default is a placeholder; you'll almost always override it.
Output is a single IMAGE tensor. Wire it into any image input: a VAE encode for img2img, an IP-Adapter reference, a ControlNet preprocessor, or just straight to a preview node to see what the search turned up.
Installing it
Via ComfyUI Manager, search "ComfyUI-Google-Image-Search", or:
cd ComfyUI/custom_nodes
git clone https://github.com/gabe-init/ComfyUI-Google-Image-Search
cd ComfyUI-Google-Image-Search
pip install -r requirements.txt
cp config.json.example config.json
Then restart ComfyUI. The credentials dance is the real setup, not the install:
- In Google Cloud Console, enable the Custom Search API and create an API key.
- At cse.google.com, create a search engine with Image search enabled and "Search the entire web."
- Put both values in
config.jsonnext toapi_keyandsearch_engine_id.
Where people get burned
- Hotlinked images die. The node downloads whatever URL Google returns, and plenty of image hosts block direct fetching or serve a 403. That's the most common silent failure - you get the red tensor even though the search itself worked. Re-running often snags a different, fetchable result.
- It's not deterministic. Google's top result changes, so a workflow that depends on "the" image won't reproduce. Fine for a one-off reference grab; bad for anything you batch.
safe='off'is hardcoded. Queries can return NSFW images regardless of your intent. Keep that in mind if you share the workflow.- No caching in the code. The README suggests implementing it, but the shipped node re-spends quota on every run, so 100 searches/day goes faster than you'd think.
Author note: gabe-init is a small dev who also ships ComfyUI-LM-Studio - the pattern is "bridge an external service into ComfyUI," and this node is the simplest of those bridges. For a one-off reference image it's genuinely handy; just don't expect a battle-tested production tool.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| search_query | STRING | cat | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |