Created
December 23, 2019 17:53
-
-
Save HarveyBrezinaConniffe/4136b3847215360a4a81ad86a12b430e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.ma as ma | |
import sys | |
from PIL import Image | |
np.set_printoptions(threshold=sys.maxsize, linewidth=999) | |
x = 25 | |
y = 6 | |
rawimg = np.array(list(map(int, list(str(input()))))) | |
rawimg = np.reshape(rawimg, (-1, x)) | |
layers = np.split(rawimg, rawimg.shape[0]/y, axis=0) | |
end = np.zeros(layers[0].shape) | |
mask = np.zeros(layers[0].shape).astype(bool) | |
for clayer in layers: | |
clayer = ma.array(clayer, mask=mask) | |
end += clayer==1 | |
mask = ma.mask_or(mask, (clayer!=2)) | |
im = Image.fromarray(np.uint8(end)*255) | |
im.save("IMG.jpg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment