21 lines
419 B
Python
Executable File
21 lines
419 B
Python
Executable File
#!/usr/bin/env python
|
|
# This script generates a raw image file for use with the userspace display driver.
|
|
|
|
import sys
|
|
|
|
from PIL import Image
|
|
im = Image.open(sys.argv[1]);
|
|
pix = im.load()
|
|
|
|
data=0
|
|
|
|
foo=0
|
|
for y in range(0, im.size[1]):
|
|
for x in range(0,im.size[0]):
|
|
if (pix[x,y]):
|
|
data = data | (1 << (7 - (x % 8)))
|
|
if (((x+1) % 8) == 0):
|
|
sys.stdout.buffer.write(data.to_bytes(1, byteorder='big'))
|
|
data = 0
|
|
|