NFTs are the new crazeNo matter where you live or who you are, you have probably heard of NFTs by now.I never paid much attention to it. I had a good idea of what NFTs were and how they worked from coming across it on Twitter or Tech articles, but it wasn't enough to hook me in.After browsing some of the NFT marketplaces recently, I noticed how a big part of available NFTs were images of randomly generated characters. This made sense -- if you were looking to generated hundreds, thousands, or tens of thousands of NFTs, there was no easier way than randomly generated them.Now, you could create images of random colors and shapes but that was no fun. There was no character or personality to it. So the question then is: how do you make randomly generated content appealing?The answer is: you give them hats. And clothing. And cool hairstyles. And horns. And you make them blue. Then you make them only have some features. Some are aliens, some are monkeys, some are humans. Some have rare features; some have common features.This was the side of NFTs that finally got my attention. Creating randomly generated NFTs using "pre-made parts" seemed like it could be a fun challenge to tackle. So, I tried.
There were two parts to this adventure:
There was just one problem -- I can't draw to save my life. I also know I didn't want to make an actual character, I wanted to do something different. It was around Christmas time, so inherently, I decided on Christmas Trees. This was my attempt:With that, the first part was done. The basic assets had been created:
- 1. Create the underlying image assets that would be used to create the NFTs.
- 2. Create the script that would stitch the image assets together.
The only part left now was creating the script to stitch it all together. I decided to write it on Python since I've been trying to get more familiar with it.The script was divided in two parts.The first part created the "skeleton" of the Christmas Tree. In other words, a randomly generated string that determined what type of tree it would be--what kind of foliage, what tinsel arrangemnt it would have, which ornaments, etc.The second part was to actually generate the tree image. I used Pillow, a Python Image Library, to load each asset and stitch it together according to each tree's "metadata". This is the end result:All in all, this was a fun project. I'm planning on making the code a little more flexible so it can be used for more than just Christmas Trees. The goal is so the script also exports the attributes of each NFT and does the bulk upload to marketplaces. That's for another day.
- Multiple background colors
- Base trunk
- Multiple foliage colors and patterns
- Multiple tinsel colors and variations
- Multiple ornament options and locations
- Multiple star options