I'm trying to make a generator for images combined. I'm trying to have the images side by side and when It gets to 4 images go down. And I'm trying to paste a gray png over the images with text on it saying the name of that skin or item.
Here's my code so far:
def main():
image = requests.get("https://fortnite-api.com/v2/cosmetics/br/new").json()
image_path = image['data']['items']
for i in image_path:
if i['rarity']['displayValue'] == 'Legendary':
filename = f"data/images/{i['id']}.png"
skin = Image.open(filename, 'r').convert("RGBA")
filename1 = 'data/assets/Legendary_Background.png'
bg = Image.open(filename1, 'r')
text_img = Image.new('RGBA', (512,512), (0, 0, 0, 0))
text_img.paste(bg, (0,0))
text_img.paste(skin, (0,0), mask=skin)
text_img.save(f"data/out/{i['id']}.png", format="png")
Here's the raw images:
Legendary_Background:
Gray Slide:
I want to paste another png on top of the skin so In theory it should look like this:
question from:
https://stackoverflow.com/questions/65940355/paste-png-over-png-pil-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…