Python图像处理-3.pil裁剪、旋转粘贴图片

from PIL import Image
import matplotlib.pyplot as plt

pil_im1 = Image.open('pic1.png')

plt.figure("girlfriend1")
plt.imshow(pil_im1)

box = (100,100,400,400)
region = pil_im1.crop(box)#cut from the picture
plt.figure("girlfriend2")
plt.imshow(region)

region = region.transpose(Image.ROTATE_270)#rotate the image
pil_im1.paste(region, box)
plt.figure("girlfriend3")
plt.imshow(pil_im1)

plt.show()
发布了28 篇原创文章 · 获赞 39 · 访问量 6798

猜你喜欢

转载自blog.csdn.net/qq_36071362/article/details/104000027