In [61]:
import matplotlib.image as image
import numpy as np
from PIL import Image
color = [0,0,0]
filas, columnas = 200, 200
n = 8
nI = filas/n
nJ = columnas/n
img = np.ones((filas, columnas, 3))
def pintar(img,x0,x1,y0,y1,color):
for x in range(int(x0),int(x1)):
for y in range(int(y0),int(y1)):
img[x][y] = np.array(color)
for i in range(n):
for j in range(n):
if (i+j)%2==1:
pintar(img,i*nI,(i+1)*nI,j*nJ,(j+1)*nJ,color)
im = Image.fromarray(np.uint8(img*255))
im.save('img/imagen.png')
im
Out[61]:
No hay comentarios.:
Publicar un comentario