Не качество производства, но, вероятно, достаточно, чтобы вы начали, я думаю, что это должно быть примерно так:
#!/usr/bin/env python3
from PIL import Image
import numpy as np
w, h = 192, 192
# Create RGB output array h, w, 3
out = np.zeros((h,w,3),dtype=np.uint8)
file = 1
# Iterate over 3 channels, Red, Green and Blue- or maybe B, G, R
for channel in range(3):
# Iterate over the 8 bits in each channel
for bitpos in range(8):
filename = f"{file}.png"
print(f"Opening {filename} as bit {bitpos} of channel {channel}")
im = Image.open(filename).convert('L')
# Convert to Numpy image with range 0..1
ni = (np.array(im)/255).astype(np.uint8)
# Shift and stuff into output array
out[...,2-channel] |= ni << (bitpos)
file += 1
result = Image.fromarray(out)
result.save('result.png')
Пример вывода
Opening 1.png as bit 0 of channel 0
Opening 2.png as bit 1 of channel 0
Opening 3.png as bit 2 of channel 0
Opening 4.png as bit 3 of channel 0
Opening 5.png as bit 4 of channel 0
Opening 6.png as bit 5 of channel 0
Opening 7.png as bit 6 of channel 0
Opening 8.png as bit 7 of channel 0
Opening 9.png as bit 0 of channel 1
Opening 10.png as bit 1 of channel 1
Opening 11.png as bit 2 of channel 1
Opening 12.png as bit 3 of channel 1
Opening 13.png as bit 4 of channel 1
Opening 14.png as bit 5 of channel 1
Opening 15.png as bit 6 of channel 1
Opening 16.png as bit 7 of channel 1
Opening 17.png as bit 0 of channel 2
Opening 18.png as bit 1 of channel 2
Opening 19.png as bit 2 of channel 2
Opening 20.png as bit 3 of channel 2
Opening 21.png as bit 4 of channel 2
Opening 22.png as bit 5 of channel 2
Opening 23.png as bit 6 of channel 2
Opening 24.png as bit 7 of channel 2