def copy_paste(path):
from PIL import Image
import matplotlib.pyplot as plt
image = Image.open(path)
box = (100, 100, 400, 400)
region = image.crop(box)
region = region.resize((500, 500))
region = region.rotate(45)
print(region.shape())
box2 = (400, 400, 400+region.width, 400+region.height)
image.paste(region, box2)
plt.figure("image", figsize=(15,8))
plt.subplot(121)
plt.imshow(image)
plt.subplot(122)
plt.imshow(region)
plt.pause(5)
if __name__ == '__main__':
path = '../data/imgs/hdrplus.png'
copy_paste(path)