Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Static analysis of an unknown compression format. Parent comment
import sys import math from PIL import Image def getSize(len, width): h = int(math.ceil(float(len) / width)) return (width, h) def getImage(file, width=256): d = file.read() s = getSize(len(d), width) im = Image.new('L', s) im.putdata(d) return im def main(): if len(sys.argv) < 2: print 'Usage: file2img.py <file> <output> [width]' return with open(sys.argv[1], 'rb') as f: if len(sys.argv) > 3: width = int(sys.argv[3]) img = getImage(f, width) else: img = getImage(f) img.save(sys.argv[2]) if __name__ == "__main__": main()
http://i.imgur.com/7yEHR.png
There are no comments on this comment yet.
http://i.imgur.com/7yEHR.png