1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import os, numpy
from PIL import Image, ImageDraw, ImageFont
import utils
import blend_modes
def creerImageCarte(title,type,source,size,reach,pv,caracPhy,caracMental,js):
## Ajout de l'illustration
bg = Image.open('./images/FondCreature.png').convert("RGBA")
logoName = utils.clean_filename(title + '_logo.png')
logo = Image.open('./images/' + logoName).convert("RGBA")
logo, startX, startY = utils.prepareLogoSize(logo, bg)
# Création du masque avec logo à la bonne taille + décalage
fg = Image.new('RGBA', bg.size)
fg.paste(logo, (startX, startY))
bg_array = numpy.array(bg).astype(float)
fg_array = numpy.array(fg).astype(float)
blended_array = blend_modes.multiply(bg_array, fg_array, 1.0) |
Partager