Added beginning of img2bin, though it only converts a 8x8 pixel image at the moment.
This commit is contained in:
parent
1680a0695e
commit
5224d67b08
|
@ -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))
|
||||||
|
|
||||||
|
|
Reference in New Issue