Coder Social home page Coder Social logo

Comments (5)

Fusion4233919 avatar Fusion4233919 commented on September 5, 2024

just composite them as the order you like

remember: the right one is the upper one

image

from nft-image-generator.

0xharkirat avatar 0xharkirat commented on September 5, 2024

@Fusion4233919 Thanks a lot, let me try.

from nft-image-generator.

0xharkirat avatar 0xharkirat commented on September 5, 2024

@Fusion4233919 Yayy!!!!, It worked. Thanks a lot

from nft-image-generator.

jankyvision avatar jankyvision commented on September 5, 2024

Hi @benyaminahmed, having a similar issue and wondering if you could help me out. Trying alpha.composite 4 images using this code

#### Generate Images    
for item in all_images:

    im1 = Image.open(f'./trait-layers/backgrounds/{background_files[item["Background"]]}.jpg').convert('RGBA')
    im2 = Image.open(f'./trait-layers/elephants/{elephant_files[item["Elephant"]]}.png').convert('RGBA')
    im3 = Image.open(f'./trait-layers/hats/{hat_files[item["Hat"]]}.png').convert('RGBA')
    im4 = Image.open(f'./trait-layers/smoke/{smoke_files[item["Smoke"]]}.png').convert('RGBA')

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

    #Convert to RGB

    rgb_im = res.convert('RGB')
    file_name = str(item["tokenId"]) + ".png"
    rgb_im.save("./images/" + file_name)

And getting this error:

ValueError: images do not match
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/lq/nw0y9p2s6dnglsnqyls1d4qc0000gn/T/ipykernel_8510/2369437489.py in <module>
     10     com1 = Image.alpha_composite(im1, im2)
     11     com2 = Image.alpha_composite(im3, im4)
---> 12     res = Image.alpha_composite(com1, com2)
     13 
     14     #Convert to RGB

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PIL/Image.py in alpha_composite(im1, im2)
   3042     im1.load()
   3043     im2.load()
-> 3044     return im1._new(core.alpha_composite(im1.im, im2.im))
   3045 
   3046 

ValueError: images do not match

from nft-image-generator.

jankyvision avatar jankyvision commented on September 5, 2024

Solved 2 images were not the same size 🙃

from nft-image-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.