first commit
This commit is contained in:
commit
1b017953ee
22 files changed
+240604
No files matched your search
+120000
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 269 KiB |
@@ -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())
|
||||
@@ -0,0 +1 @@
|
||||
pillow==11.3.0
|
||||
Reference in new issue
Block a user