build/pypng/pnglsch
author Siddharth Agarwal <sid.bugzilla@gmail.com>
Wed, 10 Aug 2011 19:02:14 +0530
changeset 8729 923b924c9422bddc54a3d8c08b765da58dddeedd
permissions -rw-r--r--
Bug 659788 - Add icons for Windows 7 jumplist taskbar items. r=Standard8 The patch does the following at build time: - extract the icons from the mail-toolbar-aero.png sprite sheet - add an icon header to each png to convert it into an ico - embed the icos in the EXE To do this it adds the MIT-licensed pypng library to the tree.

#!/usr/bin/env python
# $URL: http://pypng.googlecode.com/svn/trunk/code/pnglsch $
# $Rev: 107 $
# pnglsch
# PNG List Chunks

import png

def list(out, inp):
    r = png.Reader(file=inp)
    for t,v in r.chunks():
        add = ''
        if len(v) <= 28:
            add = ' ' + v.encode('hex')
        print >>out, "%s %10d%s" % (t, len(v), add)

def main(argv=None):
    import sys

    if argv is None:
        argv = sys.argv
    arg = argv[1:]

    if len(arg) > 0:
        f = open(arg[0], 'rb')
    else:
        f = sys.stdin
    return list(sys.stdout, f)

if __name__ == '__main__':
    main()