Skip to content

Instantly share code, notes, and snippets.

@lmacchiavelli
Created July 10, 2020 14:06
Show Gist options
  • Save lmacchiavelli/76de4b584db634e3e4095aa8ffb7ddb8 to your computer and use it in GitHub Desktop.
Save lmacchiavelli/76de4b584db634e3e4095aa8ffb7ddb8 to your computer and use it in GitHub Desktop.
Incollare un immagine sopra uno sfondo con PIL
from PIL import Image, ImageDraw
background = Image.open("immagine-di-background.png" )
immagine-da-incollare-sopra = Image.open('img/elementi/layoutB.png')
width, height = background.size
transparent = Image.new('RGBA', (width, height), (0,0,0,0))
transparent.paste(background, (0,0))
transparent.paste(immagine-da-incollare-sopra, (0,0))
background.save('immagine-da-salvare.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment