from __future__ import print_function
from PIL import Image
"""
需求:给图片右下角添加中国国旗
欢迎国庆,喜庆70周年
"""
class Picture:
def handle_picture(self):
# 打开图片模版
img1 = Image.open("icon.png")
# img1 = img1.convert('RGBA')
# 打开原来的微信头像
img2 = Image.open("test.jpg")
if img2.size != (700, 700): # 判断图片大小,统一改为 700*700
# 修改图片尺寸
size = (700, 700)
img2.thumbnail(size)
img2.show()
# 将img1 粘贴到 img2
img2.paste(img1, (532, 526))
img2.show() # 显示图片
img2.save("new.png") # 保存生成的头像图片
t0 = Picture()
t0.handle_picture()
给图片(微信头像)右下角添加中国国旗
Search
Latest Comments
Categories
Archives
- 2025 年 10 月 (248)
- 2025 年 9 月 (58)
- 2023 年 2 月 (1)
- 2022 年 3 月 (1)
- 2021 年 2 月 (1)
- 2020 年 7 月 (1)
- 2019 年 9 月 (2)
- 2018 年 9 月 (1)
- 2018 年 8 月 (2)
- 2018 年 6 月 (2)
- 2018 年 5 月 (3)
- 2018 年 2 月 (2)
- 2018 年 1 月 (1)
- 2017 年 12 月 (2)
- 2017 年 10 月 (1)
- 2017 年 7 月 (1)
- 2017 年 4 月 (1)
- 2017 年 2 月 (1)
- 2016 年 11 月 (1)
- 2016 年 10 月 (1)
- 2016 年 8 月 (2)
- 2016 年 7 月 (1)
- 2016 年 6 月 (3)
- 2016 年 4 月 (4)
- 2016 年 3 月 (5)
- 2016 年 2 月 (5)
- 2016 年 1 月 (2)
- 2015 年 12 月 (1)
- 2015 年 11 月 (3)
- 2015 年 9 月 (1)
- 2015 年 8 月 (2)
- 2015 年 7 月 (8)
- 2015 年 6 月 (5)
- 2015 年 5 月 (3)
- 2015 年 4 月 (4)
- 2015 年 3 月 (3)
- 2015 年 2 月 (1)
- 2015 年 1 月 (1)
- 2014 年 10 月 (1)
- 2014 年 9 月 (2)
- 2014 年 8 月 (3)
- 2014 年 7 月 (4)
- 2014 年 6 月 (1)
- 2014 年 5 月 (3)
- 2014 年 4 月 (15)
- 2014 年 3 月 (5)
- 2009 年 7 月 (1)
Tags
Newsletter
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Insert the contact form shortcode with the additional CSS class- "bloghoot-newsletter-section"

By signing up, you agree to the our terms and our Privacy Policy agreement.