Skip to content

Instantly share code, notes, and snippets.

@kevinhowbrook
Last active June 2, 2018 14:01
Show Gist options
  • Save kevinhowbrook/3b78a4bc19f7b1dad00a6ac4289a7537 to your computer and use it in GitHub Desktop.
Save kevinhowbrook/3b78a4bc19f7b1dad00a6ac4289a7537 to your computer and use it in GitHub Desktop.
#onmedium
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