If I have
and
need to get
def create_avatar(username):avatar, frame, avatar_id = get_avatar(username)if avatar is not None and frame is not None:try:image = Image.new("RGBA", size)image.putalpha(0)# Paste avatar onto background with positioning offsetimage.paste(avatar, (157, 160), avatar)# image.save('DEBUG-avatar-pasted.png')# Paste frame over avatar and background retaining transarencyimage.paste(frame, (0, 0), frame)except Exception as e:print(e)image = Image.open("images/unknown_avatar.png").resize((512, 512))elif avatar is not None:image = Image.open(f"images/{avatar_id}.png").resize((512, 512))else:image = Image.open("images/unknown_avatar.png").resize((512, 512))image.save(f'images/{username}.png', format='png')
I have a problem with Bad transperancy mask, but need to do that
Output image sizes needs to be 512x512