Danbooru Posts Downloader
Bulk-download Danbooru images straight into your training folder
- file_paths
DanbooruPostsDownloader downloads images from Danbooru matching a tag search and saves them directly under your ComfyUI output directory, with sensible auto-incrementing filenames and a prefix option. It's the dataset-collection node - the "download 50 images of this character for a LoRA" button, minus the manual browser work.
If you're putting together a training set for an anime character or style LoRA, this is where the pack's Danbooru corner gets practical: it's the first step of "collect images → caption them → train," and it slots into that pipeline neatly because it's designed for exactly that folder-and-prefix workflow.
How it works
The node takes your tags (Danbooru search syntax - hatsune_miku solo, ratings, whatever the board accepts), computes how many 20-post API pages it needs for n, and fetches them from posts.json. Then for each post it downloads the image file (file_url) into dir_path under your ComfyUI output folder. Filenames follow a numbering scheme: with a prefix set, files are prefix_1, prefix_2, ... continuing from whatever's already in the folder; without one, plain numeric names, starting after the highest existing number. Either way, re-running the node won't clobber your existing downloads, and it skips files that already exist.
The output is file_paths - the list of saved file paths (relative to the output dir). There's no image tensor output; this node is for getting files onto disk, so it pairs naturally with the pack's DownloadImage (which loads a single image as a tensor) or its captioning sibling SaveImageWithText.
Inputs
All four are simple:
tags- Danbooru search tags. Default empty (which just pulls recent posts).n- number of images to download (default 1).dir_path- destination directory relative to the ComfyUI output folder. Default empty = the output folder root.prefix- filename prefix, optional.
Install
Part of ComfyUI-Alchemine-Pack:
cd ComfyUI/custom_nodes
git clone https://github.com/alchemine/comfyui-alchemine-pack
pip install -r requirements.txt
Or via ComfyUI Manager (search "ComfyUI-Alchemine-Pack"). Uses plain requests; no models to download.
Common issues
The search API returns whatever the board's filters allow - if you're hunting NSFW content for a dataset, Danbooru's anonymous API tier restricts it, and posts whose file_url is missing or blocked are silently skipped (you'll see it in the logs). Big n values mean paginated fetches plus one download per image with a 120-second timeout each - a flaky connection will drop some files mid-batch, so check the console for "Failed to download" lines. And you're storing other people's art on disk; for training that's on you to reconcile with Danbooru's terms and the model licensing you're using.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| tags | STRING | — | |
| n | INT | 1 | — |
| dir_path | STRING | — | |
| prefix | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_paths | STRING | — |