In [1]:
import numpy as np
from PIL import Image
In [2]:
src = np.array(Image.open('data/src/lena_square.png').resize((128, 128)))
dst = np.array(Image.open('data/src/lena_square.png').resize((256, 256))) // 4
In [3]:
dst_copy = dst.copy()
dst_copy[64:128, 128:192] = src[32:96, 32:96]
In [4]:
Image.fromarray(dst_copy).save('data/dst/lena_numpy_paste.jpg')
In [5]:
dst_copy = dst.copy()
dst_copy[64:192, 64:192] = src
In [6]:
Image.fromarray(dst_copy).save('data/dst/lena_numpy_paste_all.jpg')