You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pxl_oboard/im_convert.py

18 lines
359 B

from PIL import Image
# convert("example.png") // png/jpg/gif
def convert(filename, move = [0,0]):
im = Image.open(filename).convert('RGB')
pxls=im.load()
w=im.size[0]
h=im.size[1]
ll = []
for x in range(w):
for y in range(h):
# [x,y, [r, g, b]]
rgb = pxls[x,y]
ll.append( [x + move[0], y + move[1], rgb[0], rgb[1], rgb[2] ] )
return ll