r/StableDiffusion • u/hzzzln • Mar 31 '23
Workflow Included Using Stable Diffusion to Create Custom Artwork for a Card Game
I recently started building my own version of Settlers of Catan and wanted to create my own playing cards for the Cities and Knights expansion. Instead of using pre-existing artwork, I decided to try using AI-generated images. I was blown away by the results I got using Stable Diffusion, which produced artwork with a consistent style that was even better than what I could have found online. Here's how I did it:
I have a 3070 so I was confident that I could run Stable Diffusion locally. I installed the Automatic1111 web UI and found some example prompts online that I liked on Civitai with this model: https://civitai.com/models/1239/stylized-rpg-game-icons. The prompts were all formatted like "Stylized game icon, medieval, European, by Greg Manchess, trending on ArtStation" with negative prompts like "Low quality, worst quality, (3D model: 0.4)." Some details, mostly faces and hands, were improved with inpainting.




Next, I wanted to create some pretty card frames, so I used prompts like "(Trading Card Game: 1.1) template (card frame: 1.1), symmetric, single, fantasy, ArtStation, Greg Manchess." This was a bit more difficult, and it took me a while to get something usable.

Even then, I wasn't completely satisfied with the layout of the frame, so I cut and resized it in GIMP and made more passes using Img2Img until I was happy with the final result. Created a few variations of these, matching the three types of cards I wanted to have. The paper background for the text is also a texture generated by Stable Diffusion. Finally I added a vignette and a splash of color using GIMP again.

Finally, I created a .CSV file with all the card names, descriptions, and image filenames, and used a Python script to load the CSV and plug all the values into a Jinja2 template. The template included some CSS and HTML to ensure that everything was properly aligned.




11
6
5
u/AramaicDesigns Mar 31 '23
I'm using an AI model I've trained on my own art, photography, and a bunch of out of copyright movies to build the initial art set for a classic cardgame I'm helping resurrect.
It has been a game changer for me.
1
u/gblRiseUp Mar 02 '24
u/hzzzln Looks great, any chance you share the code around that ?
Thankss
1
u/hzzzln Mar 03 '24
Anything specific you are looking for? Honestly the whole code is pretty hodgepodge with a lot of manual tinkering to get usable results. Used some pretty hacky HTML/CSS to get everything to look right
1
u/gblRiseUp Mar 04 '24
I like the python script to use a jinga template from a csv and insert the image. looks smarttt
2
u/hzzzln Mar 05 '24
That was the easy part. A python file like this:
import csv from jinja2 import Environment, FileSystemLoader env = Environment(loader = FileSystemLoader(searchpath=".")) csvfile = open("csvfile.csv") cardtemplate = env.get_template("template.html") reader = csv.DictReader(csvfile) cards = [] for row in reader: newcard = {k: v for k, v in row.items()} cards.append(newcard) html = open("cards.html", "w") html.write(cardtemplate.render(cards=cards))Template:
<!DOCTYPE html> <html> <body> <table> <tr> {% for card in cards %} <td style="border: 5px solid red"> <h2>{{card.name}}</h2> {{card.description}} </td> {% endfor %} </tr> </body> </html>And CSV file:
name,description Card 1,Description 1 Card 2,Description 2 Card 3,Description 3Should get you started.
1
3
1
u/UnfortunateTrombone Mar 31 '23
The Simulacrum is a pc card game that also uses stable diffusion for its card art, since it has randomly generated cards and needed a lot of different art. Could help with inspiration.
3
u/LD2WDavid Mar 31 '23
Good idea. As a quick tip if you can give some sketch or doodle for better structure will make AI easier to get the images, even the slidghtest line you can help with, will be valuable when inferencing.
Nice job by the way.