#
2つの4x8画像を1列ごとに入れ子にして8x8を作る。 1次元行列 → vstack → 軸入れ替え → 2次元行列、でやってます。
import numpy as np from PIL import Image # make array a = np.arange(32).astype(np.uint8).reshape(4,8)*8 b = a+128 # x =a.reshape(-1,) y =b.reshape(-1,) vs_val = np.vstack((x,y)).reshape(2,-1) vs_val = vs_val.T.reshape(8,8) print(vs_val) #make image file pilImg = Image.fromarray(np.uint8(vs_val)) pilImg.save('test20190114.pgm')