Skip to content

Instantly share code, notes, and snippets.

@take-cheeze
Created March 3, 2012 16:43
Show Gist options
  • Save take-cheeze/1966931 to your computer and use it in GitHub Desktop.
Save take-cheeze/1966931 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import zlib
import Image
print "// openning", sys.argv[1]
img = Image.open(sys.argv[1])
width, height = img.size
assert(width == 12*13)
assert(height == 12*4)
print "uint16_t const EXFONT[26*2][12][12] {"
for base_y in xrange(4):
for base_x in xrange(13):
print "{"
for y in xrange(12):
mask = 0;
for x in xrange(12):
if img.getpixel((12 * base_x + x, 12 * base_y + y)):
mask |= 0x01 << x
print mask, ","
print "},"
print "}; // EXFONT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment