26.8 C
New York

Generating a saleable NFT Collection, the easy way with Python !

Date:

Generating a saleable NFT Collection, the easy way with Python ! Blockchain PlatoBlockchain Data Intelligence | Vertical Search AI
Bored Ape Example

First of all, I am not a NFT expert, nor a buyer but i am curious. Curious to know how could be generated these images sold thousands (millions) of dollars.

First let me explain what is a NFT ?

«Non fungible token» is a “simple” way to have the property on a digital object. The objective is to generate Proof of Ownership thanks to the blockchain. This doesn’t mean people can’t use your item (image, music, videos, virtual land …) but it means that you are the owner of this item, this digital item.

This idea comes from a purely subjective observation, some NFT collections seem to be the superposition of layers.

Generating a saleable NFT Collection, the easy way with Python ! Blockchain PlatoBlockchain Data Intelligence | Vertical Search AI
Credit : niftygenerator.xyz

In this illustration, we have 5 “Features” :

  • Hair
  • Outfit
  • Expression
  • Body
  • Pet

Each feature has a number of options, so the idea will be to combine all these options to generate the NFT.

For example, if I have 3 features :

  • Hair : 3 options
  • Face : 2 options
  • Glasses : 2 options

I can generate 12 “unique” images.

  1. Python (+ pip install Pillow)
  2. Some transparent .png with the same size (several Features & Options)

The process is very simple, our images will be the superposition of an option from each feature. I create very (very very) simple images to build my “features library”.

Generating a saleable NFT Collection, the easy way with Python ! Blockchain PlatoBlockchain Data Intelligence | Vertical Search AI
2 features — Head (3 options) and Hats (5 options)

First, import image from Pillow :

from PIL import Image

Then, I decide to create lists with all the file names :

HEADS = [“head_orange.png”,”head_creepy.png”,”head_white.png”]
HATS = [“hat_black.png”,”hat_blue.png”,”hat_red.png”,”casquette_kaki.png”,”casquette_blue.png”]

Now, let the magic happen.

img_id = 0
for head in HEADS:
for hat in HATS:
img_id += 1
hat_img = Image.open(hat)
head_img = Image.open(head)
head_img.paste(hat_img,(0,0),hat_img)
head_img.save('img_'+str(img_id),'PNG')

For each “head”, I’ll paste a hat on it, then I save the result with an incremental ID called “img_id”. It’s a simple script for a nice result.

Generating a saleable NFT Collection, the easy way with Python ! Blockchain PlatoBlockchain Data Intelligence | Vertical Search AI
The “nice result”

You can now create NFT Collection.

Related articles

spot_img

Recent articles

spot_img