Last active
June 2, 2018 14:01
-
-
Save kevinhowbrook/3b78a4bc19f7b1dad00a6ac4289a7537 to your computer and use it in GitHub Desktop.
#onmedium
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
j = 0 # vertical counter | |
k = 0 # horizontal counter | |
for i,v in enumerate(convert()): | |
if i % squares_per_row == 0 and i != 0: # if i is a multiple of squares per row | |
j += 1 # increments after the squares per row is hit like 0,0,0,1,1,1,2,2,2... | |
if i % squares_per_row == 0 and i != 0: | |
k = 0 # increments after the squares per row is hit like 0,1,2,0,1,2... | |
points = ((k*s,j*s), (k*s, j*s+s),(k*s+s,j*s+s),(k*s+s, j*s)) #set points with incrementing values :/ | |
draw.polygon((points[0], points[1], points[2], points[3]), outline='black', fill = (v[0],v[1],v[2])) # outline='red', fill='blue' | |
#borders so redraw the same plots with white lines | |
draw.line((points[0], points[1], points[2], points[3], points[0]), fill="white", width=border_width) # outline='red', fill='blue' | |
k += 1 | |
im.save('square.jpg') # save the image. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment