This utility generates spell cards based on the beautiful graphic designs originally developed by nBeebz and friends (see here).
The cards are made from a spell definition input file that you can create or customize. Included in this repository are starter files with the standard set of 5E compatible spells taken from the System Reference Document released by Wizards of the Coast LLC and available at https://dnd.wizards.com/resources/systems-reference-document. Check out the spell_data subfolder to view those starter files and the code that generated them.
You must install ImageMagick. Spell Card Maker uses the Wand library, which is a Python binding to ImageMagick.
Follow the instructions for your OS:
- Windows (64-bit) (Note: Typically it is not necessary to set the MAGICK_HOME environment variable.)
- Linux / Mac
- Install ImageMagick as noted in the Requirements.
- Grab the latest release of SpellCardMaker.exe.
- Download a copy of spells.yaml.
- Place
SpellCardMaker.exe
and thespells.yaml
input file in the same directory. - Using a terminal such as Windows PowerShell, run one of the following example commands in that directory.
Generate a single spell card from spells.yaml
:
./SpellCardMaker generate spells.yaml -s "Spell Name" -o .
Generate cards for every spell in spells.yaml
:
./SpellCardMaker generate spells.yaml -o "Output Directory"
To abort in-progress spell card generation, press CTRL
+C
on most systems
(keyboard interrupt)
./SpellCardMaker generate INPUT_FILE [-o OUTPUT_DIR] [-s SINGLE_SPELL] [-c CONFIG]
INPUT_FILE : Required
A file with spell information. This can be either a CSV or a YAML
file. See the examples included in this repository (spells.csv and spells.yaml).
Example: my_homebrew_spells.csv
OUTPUT_DIR : Optional
The folder to which spell card images are output, relative to the
working directory (the location of the .exe). Cards are placed in a folder
called output
by default if this option is not specified. Example: -o "Spell Card Output"
. To output directly into the working directory, use -o .
SINGLE_SPELL : Optional
A single spell to generate a card for. Example: -s "Magic Missile"
. If this is not specified, cards are generated for every spell that is
included in the INPUT_FILE.
CONFIG : Optional
A configuration file used to modify how spell cards are generated.
Example: -c my_config.json
.
Spell Card Maker supports the use of a configuration file to change many aspects of how spell cards are generated. For example, you can use a config file to modify spell school icons and colors, fonts used on the cards, or which classes to include in the class list on the right side of the card.
To generate a default configuration file, use the following command:
./SpellCardMaker make_config
You can then update the file as desired, and specify the config file by using
the -c
option when running the Generation command.
Images and fonts in the configuration file are often defined using a relative
filepath. These files are bundled with the application by default, but you can
provide the files yourself by placing them in the working directory (alongside
SpellCardMaker.exe). The Spell Card Maker utility will always prefer to use
files that exist in the working directory before using the default bundled
files. For example, the icon used at the top of abjuration spell cards is
defined in the default config file as resources/images/abjuration/icon.png
, as
you can see here:
"school": {
"abjuration": {
"bg_color": "#6DC3D3",
"fg_color": "#000000",
"img": "resources/images/abjuration/icon.png"
},
You can override this image by creating a resources
folder in the working
directory along with the same sub-folders and icon filname
(resources/images/abjuration/icon.png
), or you can create your own config file
to specify a new location for this image.
To add an additional class to the spell cards — or otherwise customize the class
list — you can edit the array of classes in the general.classes
configuration
section.
For example, if you add "Artificer" to that list, the "Artificer" class appears on the sidebar of all spell cards that are generated, and is highlighted for any spell that lists the "Artificer" in its "classes" list in the spell data input file.
"general": {
"classes": [
"Artificer",
"Bard",
"Cleric",
"Druid",
"Paladin",
"Ranger",
"Sorcerer",
"Warlock",
"Wizard"
],
Similarly, it is fairly straightforward to add a new school of magic to the pool
for spell card generation. Simply add your new school to the school
configuration section with similar details as the existing schools in the
configuration file. Any spells with that school listed in the spell data input
file will be stylized appropriately.
"school": {
"metamagic": {
"bg_color": "#D47B25",
"fg_color": "#000000",
"img": "resources/images/metamagic/icon.png"
},
Pyinstaller is used to build the app into a standalone executable for
release. If you would like to build the application for a non-Windows OS (or
make other customizations), it should be fairly straightforward to do so. The
included spec file (SpellCardMaker.spec
) contains the required settings and
configuration for building the app. It should be as easy as installing
Pyinstaller and then running the following command from the project directory:
pyinstaller SpellCardMaker.spec