18 lines
359 B
Python
18 lines
359 B
Python
|
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
|