使用PIL指定区域截图
作者:
one_8274 | 来源:发表于
2020-03-15 21:07 被阅读0次
使用PIL指定区域截图
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from PIL import Image, ImageDraw, ImageFont
img = Image.open("./test.png")
# 设置抠图区域
width = img.size[0] # 图片大小
height = img.size[1]
# 从图片上抠下此区域
print(width, height)
img3 = img.crop(
(
200,
100,
width - 200,
height - 100,
)
)
# 将此区域旋转180度
# region = region.transpose(Image.ROTATE_180)
# 查看抠出来的区域
# region.show()
# 将此区域粘回去
img3.save('./test1.png')
本文标题:使用PIL指定区域截图
本文链接:https://www.haomeiwen.com/subject/yfwbehtx.html
网友评论