tangstad/helds
tangstad
/
helds
Archived
1
0
Fork 0

Added beginning of img2bin, though it only converts a 8x8 pixel image at the moment.

This commit is contained in:
Truls Alexander Tangstad 2005-11-08 09:18:09 +00:00
parent 1680a0695e
commit 5224d67b08
1 changed files with 18 additions and 0 deletions

18
gba/tools/img2bin.py Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python
from PIL import Image
import sys
"""Convert image to raw binary using Python Imaging Library."""
if len(sys.argv) != 3:
print "Usage: %s <source> <target>"
print "WARNING: It only converts 8x8 pixel images at 8bit the moment."
im = Image.open(sys.argv[1])
output = open(sys.argv[2], "wb")
for x in range(8):
for y in range(8):
val = im.getpixel((x, y))
output.write(chr(val))