Added some informational prints.
This commit is contained in:
parent
1e69b994f3
commit
f0e4020280
|
@ -22,6 +22,7 @@ if __name__=="__main__":
|
|||
im = Image.open(sys.argv[1])
|
||||
output = open(sys.argv[2], "wb")
|
||||
width, height = im.size
|
||||
print "Converting %dx%d image to binary." % (width, height)
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
val = im.getpixel((x, y))
|
||||
|
@ -29,9 +30,9 @@ if __name__=="__main__":
|
|||
|
||||
if len(sys.argv) > 3:
|
||||
pal_output = open(sys.argv[3], "wb")
|
||||
print "Converting %d color palette." % (len(im.palette.palette) / 3)
|
||||
for color in split_seq(im.palette.palette, 3):
|
||||
r, g, b = map(lambda col : col >> 3, map(ord, color))
|
||||
|
||||
value = (b << 10) + (g << 5) + r
|
||||
pal_output.write(struct.pack("<h", value))
|
||||
|
||||
|
|
Reference in New Issue