build/pypng/pnglsch
author Decathlon <bv1578@gmail.com>
Wed, 26 Feb 2014 16:08:32 +0100
changeset 17025 14e26bcb0f420a89797d2aa13470b4be21f2b9ce
parent 8729 923b924c9422bddc54a3d8c08b765da58dddeedd
permissions -rw-r--r--
Bug 975157 - Day/week view: the off-time zone get shifted one hour later in the timebar when changing the "Day ends at" setting. r=markus a=philipp

#!/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()