Nodes/ComfyUI_Pixabay_Gallery/Pixabay Image Gallery
ComfyUI Node

Pixabay Image Gallery

Royalty-free stock photos, without ever leaving your canvas

By Firetheft·Created about a year ago·Updated 9 months ago· 6
Pixabay Image Gallery
    • image
    • info

    Here's a workflow habit that quietly eats your whole afternoon: you need a reference image, so you open a browser tab, hunt through Pixabay, download a file somewhere, and then drag it into a Load Image node. The Pixabay Image Gallery node exists to kill that round trip. It puts a working Pixabay browser right inside the node body - search, filter, click a card, and the node hands you the full-resolution image as a tensor plus all of its metadata as a JSON string.

    It's part of the two-node ComfyUI_Pixabay_Gallery pack by Firetheft (the sibling is PixabayVideoNode). You'd reach for this whenever a workflow needs some real, license-clean image to start from: an img2img base, a reference conditioning input for IPAdapter-style workflows, a background plate, or just a quick visual placeholder before you generate your own. Pixabay is royalty-free stock, not AI slop, and there are no model files involved.

    How it works

    This is one of those nodes where the interesting parts live in JavaScript, not Python. It has zero graph inputs - no wires in, ever. Everything you interact with (search box, dropdowns, the masonry grid) is a custom widget drawn inside the node body by the pack's front-end extension.

    Under the hood the sequence is:

    1. The UI calls a local route on your ComfyUI server (/pixabay_gallery/media), which proxies to the Pixabay API using the key from config.json.
    2. You click a card, and the selection is POSTed to /pixabay_gallery/set_image, which writes a selected_image.json file in the pack's folder.
    3. When you queue the workflow, get_selected_image() reads that file, downloads the image's largeImageURL over HTTP, and converts it to a torch tensor.
    4. It returns the image and a pretty-printed JSON string of every scrap of metadata - tags, uploader, resolution, and more.

    A neat detail: the node's IS_CHANGED value is the mtime of selected_image.json, so picking a new image and queuing re-runs the node automatically - no forcing required.

    The outputs that matter

    There are only two, and both come from the schema:

    • image - an IMAGE tensor at full resolution. Wire it into Preview Image, Save Image, or anything else that eats an IMAGE.
    • info - a STRING with the full metadata JSON. Send it to a Show Text node if you want the caption, tags, or author visible.

    In the node's UI, the filters you'll actually set are the search box and the type/orientation/color dropdowns (photo, illustration, vector; horizontal/vertical; grayscale and every color). There's also a favorites star so you can keep a working set of picks between sessions.

    Installing it

    Either use ComfyUI Manager (search for "ComfyUI_Pixabay_Gallery"), or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Firetheft/ComfyUI_Pixabay_Gallery
    

    Then do the two-step setup the README is very clear about. First, make sure requests is around (in practice it's already in virtually every ComfyUI venv, along with aiohttp, which the server-side code uses):

    pip install requests
    

    Second - and this is the part people miss - grab a free API key from the Pixabay API docs and drop it into ComfyUI/custom_nodes/ComfyUI_Pixabay_Gallery/config.json:

    {
      "pixabay_api_key": "YOUR_PIXABAY_API_KEY_HERE"
    }
    

    Restart ComfyUI and you're done. The key never shows up in the UI - it lives in that local config file.

    Where people get burned

    • The gallery won't load anything. Nine times out of ten the key is missing or still the placeholder; the server route refuses with a 400 when it sees YOUR_PIXABAY_API_KEY in the file. Fix the key, restart.
    • Transparent PNGs. The node keeps RGBA as four channels (the source explicitly converts to RGBA instead of flattening). Some downstream nodes assume 3-channel RGB and will throw or misbehave, so add a channel-conversion step if your picks have transparency.
    • A mysterious 1×1 black image. Queue with nothing selected and you get torch.zeros(1, 1, 1, 3) plus an info string that just says "No image selected." That's expected, not a bug.
    • Fails at queue time but browsing worked. The image download forces proxies off (proxies = {http: None, https: None}), so behind a corporate proxy, search works while the fetch can error. It also has a 30-second timeout and needs live internet at execution time.

    It's not a node you'll use every day, but when you need a legal, license-clean reference straight in your graph, it's hard to beat. (The pack is GPL-3 - irrelevant for personal use, a conversation only if you're shipping something commercial.) The one real complaint: the search box defaults to "Girl." Type your own query.

    Category📜Asset Gallery/Pixabay

    Inputs (0)

    No inputs

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    infoSTRING