Midjourney prompt with Python

Vanessa Pacheco
4 min readSep 27, 2023

Recently, I have been studying Chinese aesthetics for manhuas (their manga version) and donghuas (anime). And, I came up with a prompt that gave me the right result:

male character fanart, in the style of eastern zhou dynasty, charming anime characters, classicist portraiture, dark emerald and light brown, close up, romantic sensibility, cabincore — ar 37:44 — uplight — niji 5

To get this result, first, I had to study some prompts and refine my prompt wording. And, I used Python to decompose the prompts and use these little pieces to create the result you can see below.

So, taking my experience as my guide, I want to use this prompt to show you some basic coding. I’m not a programmer myself.

These small pieces of code can help you create more prompts or analyze them. To help you, I will show you some Python tricks.

First step: create a list of your prompt, just like this

a = ['''male character fanart, in the style of eastern zhou dynasty, 
charming anime characters, classicist portraiture, dark emerald and
light brown, close up, romantic sensibility, cabincore''']

Second step: we should work with this list, to create a list of terms, that we can use to analyze our prompts.

To do this, we use commas to break up the words. Then, we sort it alphabetically; lastly, we remove all extra spaces.

At the end, I add a small code to count how many tokens there are.

for word in a:
lst = word.split(',')
lst.sort()
if lst[0] == ' ':
del lst[0]

for token in lst:
token = token.lstrip()
print(token)

total = 0
for item in lst:
total = total + 1
print("total of tokens:", total)

Using this method, you will get something like this:

OUTPUT:

classicist portraiture
cabincore
charming anime characters
close up
dark emerald and light brown
in the style of eastern zhou dynasty
romantic sensibility
male character fanart
total of tokens: 8

Now, if you want to use some of these expressions to create a list of your favorite prompt words, you can do that!

*** If you have only expressions, and want to transform them into a prompt, you can do this!

a = ['''classicist portraiture
cabincore
charming anime characters
close up
dark emerald and light brown
in the style of eastern zhou dynasty
romantic sensibility
cmale character fanart''']

for name in a:
''.join(a)
b = name.replace('\n', ', ')
print(b)

*** Output:
['classicist portraiture, cabincore, charming anime characters, close up,
dark emerald and light brown, in the style of eastern zhou dynasty,
romantic sensibility, cmale character fanart']

HOW DO I USE IT? To create expressions that help me test styles. I made a short list of styles I wanted to test, and created a base prompt. Now, I can use my list to test them easier.

Python can help you clean your list and make it easier to use.

a = ['''George Barbier
Amanda Clark
Lauren Faust
Leone Frollo
Tatsuro Kiuchi
Tracie Grimwood
Charley Harper
Dan Hipp
Jack Hughes
Catherine Hyde***
Oliver Jeffers
Tatsuro Kiuchi
Melissa Launay
Dorothy Lathrop
Harriet Lee-Merrion
Mike Luckovich
Jon McNaught
Marjorie Miller
Moebius/Jean Giraud
Robin Moline
Robin Moline''']

#creating a Python list, and eliminating some undesired elements.
for name in a:
''.join(a)
new_name = name.replace('\n', ', ').replace('***', '')
artist_name = new_name.split(', ')

#eliminating repetitions
b = []
for artist in artist_name:
if artist not in b:
b.append(artist)

#creating the prompt
for names in b:
prompt = 'in the style of ' + names
print(prompt)

The output is something you can copy and paste into your prompt.

In general, I test very simple prompts because, this way, I can understand the influence of each word I use in my prompts. In this case, I’m testing how artists’ names can influence my final image. So, the result I’m looking for is something like this.

in the style of George Barbier
in the style of Amanda Clark
in the style of Lauren Faust
in the style of Leone Frollo
in the style of Tatsuro Kiuchi
in the style of Tracie Grimwood
in the style of Charley Harper
in the style of Dan Hipp
in the style of Jack Hughes
in the style of Catherine Hyde
in the style of Oliver Jeffers
in the style of Melissa Launay
in the style of Dorothy Lathrop
in the style of Harriet Lee-Merrion
in the style of Mike Luckovich
in the style of Jon McNaught
in the style of Marjorie Miller
in the style of Moebius/Jean Giraud
in the style of Robin Moline

So, on Midjourney, I will use a prompt similar to: “a woman in the style of…”.

In this case, I used Tracie Grimwood & Harriet Lee-Merrion — as examples.

left( Tracie Grimwood) and Right (Harriet Lee-Merrion)

--

--

Vanessa Pacheco

I'm a graphic designer and brand strategist, and now I'm excited to explore engineering-generated illustrations.