Monday, April 18, 2011

Smallest possible transparent PNG

Smallest possible transparent PNG: "Plus the two bytes of zlib header, 78 9c, and the Adler-32 checksum, 00 05 00 01, makes 10 bytes. Putting the whole PNG together:

>>> png = ('\x89PNG\r\n\x1A\n'
... + chunk('IHDR', struct.pack('>IIBBBBB', 1, 1, 8, 6, 0, 0, 0))
... + chunk('IDAT', codecs.decode('789c6300010000050001', 'hex'))
... + chunk('IEND', ''))
...
>>> len(png)
67"