first commit
This commit is contained in:
120000
tools/birds.init
Normal file
120000
tools/birds.init
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tools/birds.jpg
Normal file
BIN
tools/birds.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 269 KiB |
19
tools/main.py
Normal file
19
tools/main.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import sys
|
||||
from PIL import Image
|
||||
|
||||
# Convert an image to a memory initialization file.
|
||||
# 400x300@12bpp. Usage: `python3 main.py input.png > output.init`
|
||||
def main():
|
||||
im = Image.open(sys.argv[1])
|
||||
im = im.resize((400, 300))
|
||||
im = im.load()
|
||||
|
||||
for pix in ( im[x,y] for y in range(300) for x in range(400) ):
|
||||
r, g, b = map(lambda x: (x >> 4) & 0x0F, pix)
|
||||
print(f'{r:04b}{g:04b}{b:04b}')
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
1
tools/requirements.txt
Normal file
1
tools/requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
pillow==11.3.0
|
||||
Reference in New Issue
Block a user