This simple script takes random images from the faces and attributes images folder and create a full image of npc. You will need the digital version of the Deck of Endless NPC from Paizo If the images are not 520x372, you will need to either change it to this format or change the vars in the script.
Tested with Python 3.7
The script needs the Pillow package. With pip:
pip install Pillow With conda:
conda install Pillow You need to change the value of data_root variable in the code to your own path to the root of the images
data_root = r'F:\PATH\TO\IMAGES\ROOT' You have to put all the face images in the folder 'Faces'
You have to put all the attributes images in a folder 'Attributes'
You need to create an output folder 'NPC'
The result should be like this:
face images in F:\PATH\TO\IMAGES\ROOT\Faces
attributes images in F:\PATH\TO\IMAGES\ROOT\Attributes
output images will go in F:\PATH\TO\IMAGES\ROOT\NPC
You can change the name of these folders in the script if you want
Just open a command window and change folder to where the script is and type
python npc_generator.py A new image formated as this npc_YYYYMMDD_HHMMSS.jpg will be created.
Example of random output
With the base script, you can add a few things, including:
- Loop to create a high numbers of npc at once.
- Add img.show() at the end to see the image immediately
- Add a boolean to save the file or not (with img.show())
- Akarius
| Author | Date | Version | What |
|---|---|---|---|
| Akarius | 2022-09-08 | 0.1.0 | Initial version |