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()
qq_36071362 发布了19 篇原创文章 · 获赞 39 · 访问量 6360 私信 关注