DEV Community

Discussion on: NFT images generator using Python Jupyter Notebook

Collapse
victorquanlam profile image
Victor Quan Lam Author

I recommend to keep everything simple by having all the png images in the same size.

You can center the object by right click => open with 3D paint => Choose select => move the object

Alt Text

this is the result
Alt Text

Collapse
jayaych profile image
Jeremy H • Edited on

Oh thank you! Although I was looking to uncenter it. I have the letters "A", "B", "C" and "D" and I want it to be randomized between the four, but they're all centered and I want them to be randomized in the top left, top middle, top right, etc... (I drew a diagram to help) on a single background. Could this be done with coding or would it be easier to adjust each letter on it's own separate PDF file?

Thread Thread
victorquanlam profile image
Victor Quan Lam Author

Oh in this case it's easier to set the image location then. You can use something like this to change the image location.

//to resize your images
image.resize(600,600) 

// and these for setting x and y coor

self.image.xalign = 0.5
self.image.yalign = 0.5

Enter fullscreen mode Exit fullscreen mode

PUt these code into the generate images step

Thread Thread
jayaych profile image
Jeremy H

AH this is just what I was looking for! Thanks for all the help, like it seriously means a lot. Is there a way to stack this so it positions all 9 sets of images in a grid format?

Thread Thread
victorquanlam profile image
Victor Quan Lam Author • Edited on

I think you can make it work by manually set the position of these images like they are in a 2D array

#resize all the images to 1px height and 1px width

imageList =['im1',....'im10] 
for x in imageList :
    x.resize(1,1) 

#having 3x3 grid of images

im1.xalign = 0
im1.yalign = 0

im2.xalign = 1
im2.yalign = 0  

im2.xalign = 2
im2.yalign = 0  

......

Enter fullscreen mode Exit fullscreen mode

2D will look something like
0------1----------2-------------3

|
1 image1 image2 image3
|
2 image 4 image5 image6
|
3 image7 image8 image9

Thread Thread
jayaych profile image
Jeremy H

PERFECT! Thanks so much!

One (maybe) last question: when uploading the generated NFTs to OpenSea via their “Create” button, will the 9 unique properties of each one show up on the Etherscan contract (i.e. if someone goes to the contract and reads it, will the property “Top Left = A”, “Top Middle = B”, etc… show up?)?

Thread Thread
victorquanlam profile image
Victor Quan Lam Author

The metadata's attributes will be what they see

        {
            "trait_type": "Background",
            "value": "Orange"
        },
        {
            "trait_type": "Circle",
            "value": "Green"
        },
        {
            "trait_type": "Square",
            "value": "Orange"
        }
Enter fullscreen mode Exit fullscreen mode
Thread Thread
jayaych profile image
Jeremy H

Cool! Is that embedded in the image or will I have to upload it to OpenSea manually somehow?

Thread Thread
victorquanlam profile image
Victor Quan Lam Author

Well yes and no. You can create your own smart contract on Eth chain and host your NFTs on it. However, creating your own smart contract is quiet costly ( $700 or more on gas fee). This is a pro option.
Otherwise, you can use leapwork.com/ to set up automation flow to do this.

Thread Thread
jayaych profile image
Jeremy H • Edited on

This is helpful!
I've actually been watching quite a few tutorials on making my own smart contract on Truffle Suite so I might give it a try for fun. I'm mainly going off of an article on Piñata's blog found here (medium.com/pinata/how-to-build-erc...), but I'm still not quite sure how to get the 8000+ images I generated using your code on-chain all at once, seeing as the article is describing how to do it one at a time. Plus, I'm still lost on how that could be directly listed on OpenSea. Any advice?

Edit: OpenSea itself has a tutorial on how to list your ERC-721 assets, so I think I'm covered there! I'm still confused on how to get all 8000+ images onto IPFS all at once, though.