Ranbooru is an extension for the automatic111 Stable Diffusion UI. The purpose of this extension is to add a panel that gets a random set of tags from boorus pictures. This can be useful when testing a new model or to try multiple concepts without the need of writing different prompts manually. The extension evolved a lot since it's origin, so I decided to write a tutorial to explain everything you can do with it!
To install the extension just open the Automatic1111 UI and follow these instructions:
In the following subparagraphs we are going to take a look at every component available in the extension. If you just want to learn about the general usage, feel free to skip ahead.
The most basic usage of Ranbooru can be summarized as follow:
And here's some results:
To use a specific ID you just need to browse the booru you are using, choose an ID and insert it inside of the "Post ID" field:
This will work for everything:
What if we want to search for some specific tags? Let's say that we want to search for a specific tag, we just need to add this in the "Tags to search (pre)" box, for example I'm going to search for saigyouji_yuyuko:
The syntax for writing tags inside of this box is the same of the one used on boorus with the only difference that you need to separate the tags using a comma (,) and not a space.
Running the query will get something like this:
This looks nice, but I want to be sure that only one character is represented inside of the picture. Let's add solo to the prompt:
Now if I run the prompt again I should get only the character I want:
Let's try adding some negative terms to the query. For example, I want to exclude all the pictures that have a simple_background:
Keep in mind that this will filter the search results, so you'll get less results from the booru! Here's a sample:
Let's finetune again the prompt. I want to remove the hat from the results, so let's add hat to the "Tags to Remove (Post)" section:
By doing this we will get:
As you can see only one picture out of 4 does not contain the hat. This is because there are other tags which are related to the hat. We can use the asterisk to remove everything that contains a specific keyword. Let's try this prompt:
This will remove all the tags containing: hat, head and cap. Here's the result:
Finally, for this prompt, I'd like to change the hair color to black. To do this, we can add the *pink tag to the tags to remove and then add black hair in the UI prompt:
And these are the final results:
Another thing that we can change while searching is adding a Mature Rating. For example if you run a standard search without changing the rating, you'll get a mixture of SFW/NSFW pictures:
If you want to filter out NSFW pictures (or you want just those), you just need to set the "Mature Rating" radio box:
By doing this, you'll search the Booru for only the specified ratings. Keep in mind that NSFW pictures could still be generated depending by the model used.
Ranbooru has a tag filter already implemented enabled by default (the "Remove Bad Tags" checkbox). This removes most of the text and censor related tags from the final prompt (these are not filtered from the actual Booru search, but only removed before running the prompt). You can still add more tags to filter in two different ways:
If you want to generate multiple variants using a single prompt instead of multiple ones, you can flag this option:
When flagged, all the pictures created in the same execution (both for Batch count/size) will use a single prompt, for example:
You can see that all the pictures have similar compositions because they are sharing the same prompt.
By default Ranbooru accepts 100 different tags as shown by these two sliders:
In some cases you'll want to have less tags, as it can help to generate cleaner and more coherent pictures. You have two choices:
Another useful feature available is the possibility to change the color or background of a picture without having to write tags:
For example if I select:
Other than using the prompt, you can also use the picture you parse from the booru to run an img2img over it. To do this you just need to go to the img2img tab, enable it, and choose the denoising strength:
Keep in mind that when using a batch size greater than 1, the actual ratio of the picture (squared,vertical,horizontal) will be based on the last picture parsed (as far as I know is not possible to do different sizes inside of the same batch). Here's an example using the settings above:
If you want you can also use only the last image to run the img2img, by flagging the "Use last image as img2img" flag. This will help keep consistency in the ratio:
You can also use the img2img tab to send the picture to the controlnet instead of passing it to the img2img processor. When flagged, the denoising strength bar will work as a controlnet amount slider:
In this case I'm passing the picture to the controlnet with an amount of 0,5.
You'll also need to specify a controlnet to use and also pass a dummy image (because right now I've not found a way to make the code work without it).
Se for example let's use an IP-Adapter:
You don't need to enable the controlnet, as it will be automatically done by the ranbooru extension. We just need to add a dummy picture and then we can run the prompt:
In my case I got this result:
If you open the extra tab of the extension, you'll find some experimental tools:
This can be useful to create some variations when searching for a prompt with few results, or if you just want to mix things up.
By enabling the "Mix prompts" option, the final prompt used for a picture will be a mixture of different tags taken from multiple results. keep in mind that in this case the tags limit is applied before the mixing.
For example if I search for touhou characters and I mix 4 posts I can get variations of those characters:
Another interesting feature is the "Chaos Mode". This mixes the tags between the positive and negative prompt. If set to Less Chaos, it won't move the tags from your custom prompt in the negative prompt. This can lead to unexpected results like this one:
The final experimental option is: "Negative Mode". This when enabled, moves all the tags from the prompt into the negative prompt. This usually creates weird pictures:
If you have an idea for a new feature to be added, or you want your favorite booru enabled inside of ranbooru, you can open an issue on the Github repository:
Inzaniak/sd-webui-ranbooru (github.com)
If you have any issue with the extension you can also write there asking for support!
I've started developing custom models for myself a few months ago just to check out how SD worked, but in the last few months it has become a new hobby I like to practice in my free time. All my checkpoints and LoRAs will always be released for free on Patreon or CivitAI, but if you want to support my work and get early access to all my models feel free to check out my Patreon:
https://www.patreon.com/Inzaniak
If you want to support my work for free, you can also check out my music/art here: