国旗LOGO(png透明格式):
微信头像
合成结果:
import base64
import os
import re
from io import BytesIO
from PIL import Image
import tkinter as tk
from tkinter import filedialog# 水印图片 可以自己指定
#markImage=Image.open("C:\\Users\\Administrator\\Desktop\\hq.png")# 水印图片base64
base64_str='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAGcGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE5LTA5LTI0VDEyOjI1OjQ1KzA4OjAwIiB4bXA6T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llrWufgUP27/9WsXv54lq3St8LLXyL7j/+HMxySPLKO7xJGIRDfxbW7l2A13EJR9d3BO3kV+L+BVyt/8z9/U+eu2pCM4zPI6FiXl+Z0ivr/+j9d0nL5kl7++I/0+nXy/+pPxjigKRcdFSxz7RJCkqBRhMZ1JMoQx/GO9dQQqMbxjWuxG51cbq+y6+r9J781S6I2PddxUipfe2WVKPOd8Myz3yHKkP2f/7cAPIuJ119Pr/uSjltYEiIkIyiQ1KoECUQhIA3LKkmsEV/aO33HBXSxehX4veo3/uqsnDyFdmvsmdN3VL7xVxO2tmblyNRseO75b2X+63/4PPBP6UPh6k7iaBqTigaHAQu07+AC1cxrwB8BryZ//O3Z+Lt/3O31OAeA+v/5v8zqe+9+Kft//LO+C953ZMyX80DsxKWAN7u8Fudw8QK7bmNPxr1csLrPLbt7wGx3l+M4wK54/Rf0kOvogtV5XKCcfuN3gW/R3YafCfBNF6zO8Rrwe7ib5/Qnz2Gi1Q1rq1Hz+pYLVnvxeJRz0OhEoP6eXogLVmtxd885bLQiy/72brWX7nWgC9ajse8X2nEOCWPcP8v+9t5rq/t9cBesB+OhX2jHOaQ0GhsKuwNHHrrRWo91HO0p7tYa2DvaOc6D0dJzRlT1L+ihPIseIQE+ibl8juP0CAHbLnTL4Va+iYuV4/QcATsxv9nthfQQ/wL4g24vwnGcO5GmmPsfAn+re0vpCS5iJQnlbi/EcZw7aRasApbc+Hj3ltN1fhP4frcX4TjO3WmuDSpzuF3D38fFynF6mtuLGb+PnbiHje8C/6Tbi3AcZ2/kHnmjfwb8VofX0i3+HfAb3V6E4zj3517tIr6OWR0HnT/Hxcpx+oa9+tt8nYPtHn4P+Gq3F+E4zv65X0Ouf4LtnF3swFo6yT/m8Li8jnNguFcM63YKWPOufs/T+gDbCf1etxfiOM6D8/8DCcnXdVfyaGMAAAAASUVORK5CYII='
base64_data = re.sub('^data:image/.+;base64,', '', base64_str)
byte_data = base64.b64decode(base64_data)
image_data = BytesIO(byte_data)
markImage = Image.open(image_data) # 原始微信头像
#originImage = Image.open("C:\\Users\\Administrator\\Desktop\\a.jpg")
root = tk.Tk()
root.withdraw()
fileName = filedialog.askopenfilename()
originImage = Image.open(fileName)# 新建一张950*950 大小的白色背景图片
newImage=Image.new('RGBA', (950,950), (255,255,255,255))# 置入原始图片 并且将原始图片强制设置为850*850,起始位置(50,50)
newImage.paste(originImage.resize((850,850),Image.ANTIALIAS), (50,50))# 设置国旗水印图片大小
markImage=markImage.resize((300,300),Image.ANTIALIAS)# 置入国旗水印图片 右下角
r,g,b,a=markImage.split()
newImage.paste(markImage, (650,650,950,950),mask=a) # 预览合成头像
newImage.show()
PS:代码供学习研究,运行需要Python3环境,非开发人员可以直接用微信打开腾讯官方程序生成头像:
地址:https://rl.inews.qq.com/h5/nationaldayhead?from=groupmessage
或者用微信扫描下面二维码打开:
拿走不谢^-^