DEV Community

Discussion on: NFT images generator using Python Jupyter Notebook

 
victorquanlam profile image
Victor Quan Lam • Edited

Can you try to add a new composite? It will let the processor know which combination of shapes you want to generate.

for item in all_images:

    im1 = Image.open(f'./layers/backgrounds/{background_files[item["Background"]]}.jpg').convert('RGBA')
    im2 = Image.open(f'./layers/circles/{circle_files[item["Circle"]]}.png').convert('RGBA')
    im3 = Image.open(f'./layers/squares/{square_files[item["Square"]]}.png').convert('RGBA')

// add this line of code
    im4 = Image.open(f'./layers/squares/{square_files[item["Turtle"]]}.png').convert('RGBA')

    #Create each composite
    com1 = Image.alpha_composite(im1, im2)
    com2 = Image.alpha_composite(com1, im3)

// add new combination 3
com3 = Image.alpha_composite(com2, im4 )

    #Convert to RGB
    rgb_im = com3.convert('RGB')
Enter fullscreen mode Exit fullscreen mode


`

You can use for statement to handle this process better. something like this
`

for shape in shapeList:
    // generate rgb_img....
Enter fullscreen mode Exit fullscreen mode


`