Skip to content

Instantly share code, notes, and snippets.

@jilm jilm/
Created Jan 27, 2019

What would you like to do?
A script to show a picture with grid
import PIL.Image
import sys
filename = sys.argv[1]
im =
im = im.convert('L')
w, h = im.size
gs = min(w, h) // 12
for r in range(h // gs):
for c in range(w):
coor = (c, r * gs)
im.putpixel(coor, 255-im.getpixel(coor))
for r in range(h):
for c in range(w // gs):
coor = (c * gs, r)
im.putpixel(coor, 255-im.getpixel(coor))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.