Make sure you have installed required software:
Download this repository from GitHub and unpack it on your computer
⚠️ Here you will need some skills of working with terminal. If you are using Windows, you can use PowerShell. Just open it and navigate to a directory where you have unpacked project, likecd C:\Dev\n\tnft-generator
- Install yarn packet manager:
Node.js comes with npm but in this project we using yarn, so lets install it: npm install --global yarn
- Install Everdev.
It is a console utility which helps to run local blockchain. Type in console: npm install -g everdev
- Install requirements:
pip install -r requirements.txt
- Install Ever OS Startup Edition using everdev:
everdev se start
Make sure you have docker running! This command will download and install local blockchain.
After installation you can open http://localhost/ in your browser and you should see the network explorer.
This project includes jupyter notebook files (typically python scripts with nice workflow) which easy to run in VS code. You still can open them as you want.
Open VS code and click "File" > "Open Folder..." and then select folder with this project.
✅ Since this point you can follow your guide how to make and deploy collection. Persistent approach guide for example.
This script will help you to generate images and traits. To run it just click Run All
button.
You should edit this script to add your traits and change their rarity.
This code corresponds to trait names and rarity (in %):
background = ["Green", "Yellow", "Blue", "White"]
background_weights = [30, 10, 20, 40]
body = ["Duck"]
body_weights = [100]
face = ["face1", "face2", "face3", "face4"]
face_weights = [25, 25, 25, 25]
accessory = ["accessory1", "accessory2", "accessory3", "accessory4"]
accessory_weights = [25, 25, 25, 25]
hair = ["hair1", "hair2", "hair3", "hair4"]
hair_weights = [30, 20, 10, 40]
You can name traits as you want.
Next lines of code corresponds to names of files with this traits:
background_files = {
"Green": "background1",
"Yellow": "background2",
"Blue": "background3",
"White": "background4"
}
body_files = {
"Duck": "body1",
}
face_files = {
"face1": "face1",
"face2": "face2",
"face3": "face3",
"face4": "face4",
}
You can add more traits, so you should add more files in image-source
directory.
For example, if you want to add a new background:
-
Create file
background/background5.png
-
Add this trait name and rarity:
background = ["Green", "Yellow", "Blue", "White", "Pink"]
background_weights = [30, 10, 20, 30, 10]
- Define this trait file:
background_files = {
"Green": "background1",
"Yellow": "background2",
"Blue": "background3",
"White": "background4",
"Pink": "background5"
}
How to generate more images?
By default script is set up to make 32 NFTs. You can change it in next block in generator.ipynb
TOTAL_IMAGES = 32 # Set here your number!
How to change the size of images?
By default script is set up to make 128x128 pixel images. You can find this line in the end of script:
#Resize to 128x128 pixels
im_resized = com4.resize((128,128), Image.NEAREST)
You can delite this line and images will not be resized. Or you can edit dimesions to resize images as you want.
Now you know how to generate images and have ready to battle environment.