29 lines
499 B
Python
29 lines
499 B
Python
import numpy as np
|
|
from scipy import misc
|
|
|
|
|
|
image = misc.imread("input.png")
|
|
|
|
|
|
N = min(image.shape[:-1])
|
|
image = image[:N, :N, :]
|
|
|
|
old_image = image.copy()
|
|
this_image = np.zeros(image.shape)
|
|
i = 0
|
|
|
|
print()
|
|
|
|
|
|
while((this_image != image).any()):
|
|
for x in range(N):
|
|
for y in range(N):
|
|
this_image[x, y] = old_image[(2*x + y) % N, (x + y) % N]
|
|
old_image = this_image.copy()
|
|
i += 1
|
|
print(i / (3*N), "%", " "*15, end="\r", flush=True)
|
|
misc.imsave("output/{}.png".format(i), this_image)
|
|
|
|
|
|
print()
|