Source

gauge / hex2png

#!/usr/bin/python
import sys
import Image

buf = sys.stdin.read()

# rearrange buf into parallel columns
bw=8*6
cols=128
w=bw*cols
h=256*256/cols
img = Image.new("1",(w,h))

for c in range(cols):
    colimg = Image.fromstring("1",(bw,h),buf[c*h:(c+int(bw/8))*h])
    img.paste(colimg,(bw*c,0))

img.save(sys.argv[1])