This is a custom NFT generator script that generates unique images with custom probabilities. It's a simple script that can be used to generate NFT images for your project. Follow the setup and usage instructions to get started. A UI version of this script will be available soon.
Project structure:
βββ LICENSE
βββ README.md
βββ app
βΒ Β βββ __init__.py
βΒ Β βββ images
βΒ Β βΒ Β βββ __init__.py
βΒ Β βββ launcher.py
βΒ Β βββ metadata
βΒ Β βΒ Β βββ __init__.py
βΒ Β βββ metadata_generator.py
βΒ Β βββ nft_generator.py
βΒ Β βββ nfts
βΒ Β βΒ Β βββ __init__.py
βΒ Β βββ rarity.json
βΒ Β βββ requirements.txt
βββ docs
βΒ Β βββ README.md
βΒ Β βββ __init__.py
βΒ Β βββ metadata_structure_example.json
βΒ Β βββ rarity_structure_example.json
βββ pre-commit-config.yaml
βββ requirements.txt
βββ tests
βββ __init__.py- Generate Metadata JSON files and save them automatically.
- Generate NFT images with custom probabilities and save them automatically.
- Check the possibilities and get informed if the requested numbers match the probabilities.
- Completely customizable project name, file extension, project description, NFT numbering, etc.
- Environment setup:
- The current code was run on Python 3.11.0, but it should work on Python 3.8+. Make sure to create a virtual environment and install the required packages.
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt- Requirements:
- Put all of your images in the
app/imagesfolder. The images should be named the same as the trait names in therarity.jsonfile. For example, if you have a trait named asGoldenin therarity.jsonfile, you should have aGolden.pngimage in the trait folders. Any name mismatch will cause the script to fail. - The folder names in
app/imagesshould be renamed to the trait category names in therarity.jsonfile. For example, if you have a trait category named asBackgroundorSkinetc. inrarity.json, you should have aBackgroundfolder in theapp/imagesfolder as well. Any name mismatch will cause the script to fail. - All of the images in the
app/imagesfolder should be the same size. Any size mismatch will NOT cause the script to fail, however, final images will be distorted. rarity.jsonfile should be in theappfolder. The structure of the file is explained in the docs folder,README.mdfile.- Finally when running the
launcher.pyto generate all of the NFTs, make sure to be in the correct directory and the path, which is:
$ cd app/
$ pwd
> nft-and-metadata-generator/app/- Streamlit GUI Setup and Usage:
$ pip install -r requirements.txt
$ cd app/
$ pwd
> nft-and-metadata-generator/app/
$ streamlit run streamlit_gui_generator.py
> You can now view your Streamlit app in your browser.
> Local URL: http://localhost:8501
> Network URL: http://192.168.1.114:8501- To generate all of the NFTs, run the
launcher.pyfile after modifyingrarity. jsonand putting all of the necessary images in theapp/imagesfolder. Make sure to read #Setup section before running the script:
$ python3 -m venv venv
$ source venv/bin/activate
$ python launcher.py- According to the number of NFTs you want to generate, the script will generate
the NFTs and save them in the
app/nftsfolder. It will also generate the metadata JSON files and save them in theapp/metadatafolder. It might take some time to generate all of the NFTs, so be patient. You can follow the progress throughout the logs.