#!/usr/bin/env python3 """Wraps a PNG into a single-image .ico file. Usage: png_to_ico.py in.png out.ico""" import struct import sys png = open(sys.argv[1], "rb").read() width, height = struct.unpack(">II", png[16:24]) header = struct.pack("