====== Bitmap to sprite converter written in Python ====== This is a simple Python hack that converts monochrome images with a multiple of 24x21px to an array of sprites. It can save the sprites with or without load address. Public Domain. #!/usr/bin/env python # .spr converter for arbitrary sized images (multiple of 24x21) # 1st argument: file to convert # 2nd argument: target file # 3rd argument: load address in hex (optional) # no error checking at all, I'm lazy :) import sys, struct from PIL import Image img = Image.open(sys.argv[1]).convert("1") if (img.size[0] % 24) != 0 or (img.size[1] % 21) != 0: print "image size of %s isn't a multiple of 24x21!" % (str(img.size)) print "exiting!" sys.exit(1) xoff = 0 yoff = 0 if len(sys.argv) > 3: print "adding loader address" sprbuf = struct.pack("