rounakbanik / generative-art-nft

A generative art library for NFT avatar and collectible projects.
MIT License
747 stars 372 forks source link

top layers with textures of lower opacity (slight transparency) issue #13

Open trinichad opened 2 years ago

trinichad commented 2 years ago

Hi,

I noticed when I stitch layers using the generator tool, the top layer images that have shadows with lower opacity or slight transparency make the final generated image have that transparency. See Below:

0014

image

Any ideas on how I can avoid this? Thanks, Chad

trinichad commented 2 years ago

I noticed this when I went to make a GIF in photoshop of a few of the generated images. Images were showing through each other.

wmyao commented 2 years ago

FYI. I have the issue mentioned in: https://stackoverflow.com/questions/5324647/how-to-merge-a-transparent-png-image-with-another-image-using-pil

"Image.paste does not work as expected when the background image also contains transparency. You need to use real Alpha Compositing."

I try to change the code "bg.paste(img, (0,0), img)" in line 74 of file nft.py to "bg = Image.alpha_composite(bg, img)" and it works.