This plugin allows you input some text and get an image out. It uses Stable Diffusion, an AI image-generation model. It doesn't run on your actual device like other Perchance plugins because it requires too much computational power (and would require a 3GB download), so it runs on server GPUs, which means it costs me money to run. For this reason, this plugin is funded with ads, so an ad will appear on your generator for non-logged-in users if you import this plugin. The ad will appear at the bottom of the screen like this. The ad will go away if you remove the plugin, of course. Please see the notes at the end of this page for more info.
To use this plugin, you'll first need to import it by adding this line to your lists editor:
image = {import:text-to-image-plugin}
And now try putting this in your lists editor:
character
a {mech|demon|cyberpunk} {warrior|minion|samurai}
place
soviet russia
a small village
a mountainous region
an underwater cavern
season
winter
summer
prompt
detailed painting of [character] in [place], [season]
output
[image(prompt)]
Now just write [output] in the HTML wherever you want an image to appear. Here's a live, working example of what that outputs:
You can hover your mouse over the image (or long-press on mobile) to see the prompt that was used, or click the info icon in the corner of the image. You can also manually display it below the image by using the special lastTextToImagePrompt variable:
output [image(prompt)] <br> [lastTextToImagePrompt]
Here's an example generator that uses the above code. Try playing around with the lists and saving your own copy.
As the name suggests, [lastTextToImagePrompt] will always contain the most recently used prompt. If you instead wrote [image(prompt)] � [prompt] then the prompt used to generate the image (seen on hover) and the prompt output under the image would be different, because each time prompt is evaluated, it is randomized (it's just a normal Perchance list, after all).
If you want the prompt text to be above/before the image, you can do that like this:
output [p = prompt.evaluateItem] <br> [image(p)]
Here's an example generator that uses the above code. And this example shows how to add multiple images to your generator.
Here's an example generator that has multiple images and also allows the user to input a text prompt.
There are some options/settings that you can set two different ways - the first is by putting them in a promptData list like this:
promptData prompt = painting of [character] in [place], [season] seed = 123 size = 400 // size is only a valid property for square resolutions style = border:4px solid blue; margin-top:20px; // CSS styles
You'd then write [image(promptData)] to generate an image using those settings (and in this case you can use [promptData.lastUsedPrompt] instead of [lastTextToImagePrompt] to get the prompt that was used if you want).
The second way is to put the options directly in your prompt text like this:
prompt [character] in [place] (size:::400) (seed:::123) output [image(prompt)]
Here's an example generator that has the options/settings within the prompt text itself. The options should always be at the end of the prompt, and should follow the (name:::value) format.
You can of course omit settings that you don't want to customize.
You can choose between 3 different resolutions using the resolution. The valid resolution values are 512x512, 512x768 and 768x512:
promptData
prompt = fantasy {forest|city|village|cafe|cavern|island|plains|castle|canyon|supercity|megalopolis}, extremely detailed oil painting, unreal 5 render, rhads, bruce pennington, studio ghibli, tim hildebrandt, digital art, octane render, beautiful composition, trending on artstation, award-winning photograph, masterpiece
resolution = 512x768
width = 400 // height will be auto-chosen based on aspect ratio if omitted, and vice versa for width
Here's an example generator that uses the above code, and here's a live demo of that:
There are a couple of other parameters to play with:
You'll notice that when you hover your mouse over the image there's a button which opens a menu that allows you to save images to a public gallery (for your generator), and to display said gallery. You can set the title and description that a gallery image will be saved with like this:
promptData prompt = ... saveTitle = ... saveDescription = ...
If you don't set a saveTitle and saveDescription, then by default the title will be the part of the prompt that comes before the first full-stop/comma/question-mark/exclamation-mark, and the description will be the whole prompt.
If you'd like to display the gallery on your page, rather than users having to click the button to open it, you can use "special" options list with the gallery property like this:
galleryOptions gallery = true sort = top // or 'recent' or 'trending' timeRange = 1-week hideIfScoreIsBelow = -2 // images will be removed if they get down-voted to a score below -2 adaptiveHeight = true // expand height to fit all images (so there's no scrollbar on the gallery) contentFilter = pg13 // or 'none' - EDIT: This is now always set to pg13 by default. The user must choose to switch to filter-less mode themselves. style = ... // optional CSS styles (you can delete this line)
And then just put this in your HTML editor (bottom-right editor):
[image(galleryOptions)]
The valid values for timeRange are: 1-day, 3-day, 1-week, 1-month, 1-year, all-time. Here's an example generator that displays the gallery.
You can ban users and prompt phrases from the gallery using the bannedUsers, bannedPromptPhrases, and bannedNegativePromptPhrases options. Have a look at this example to see these features in action.
galleryOptions
gallery = true
// ...
bannedUsers // click the settings button at the top of the gallery and type "admin" to toggle admin mode on, then double-click on an image to get the user ID of the creator.
263efb15c47c2d2f398e91bf169f50d4a0ca69251638c9d0eb5823c0e4fba538
f50d4a0ca69251638c9d0eb5823c0e4fba538263efb15c47c2d2f398e91bf169
bannedPromptPhrases
pg13:blood // ban the word 'blood' in pg13 mode
/twin.?towers?/ // example of 'regex'-based pattern matching to ban 'twin towers' or 'twin-tower' or 'twin_towers', and so on
pg13:/\b(gore|blood)\b/i // another example of 'regex'-based pattern matching - uses word boundaries and case-insensitive matching
bannedNegativePromptPhrases
pg13:wearing clothes // ban the word 'wearing clothes' in the *negative* prompt when in pg13 mode
You can click the settings button at the top of the gallery and type "admin" to toggle on "admin mode". This will show images that contain banned phrases with a red border instead of hiding them (useful for debugging regexes and ensuring that your ban lists aren't banning harmless prompts), and you can double-click on any image to get the user ID of the creator. Again, look at this example, for an example of these moderation features.
Notes:
As some inspiration, here are some images produced using the prompt "fantasy [thing], extremely detailed oil painting, unreal 5 render, rhads, bruce pennington, studio ghibli, tim hildebrandt, digital art, octane render, beautiful composition, trending on artstation, award-winning photograph, masterpiece":