#!/usr/bin/env python3 # Pre-release iPhone OS 1 iBoots used some weird formats for storing graphics, # this script is meant to decode Apple logo found on prototype iPod touch 1 # that ran iBoot-115.6 which is a good ole SwitchBoard gear, but with blood # # This particular example is more or less just RGBA, but long sequences # of same color are TLV encoded # # The format was likely just meant to be temporary, and provides almost no metadata, # even width & height are hardcoded into the iBoot itself import sys import struct from PIL import Image WIDTH = 71 HEIGHT = 84 def main(): try: _, file, out = sys.argv except ValueError: print("usage: %s " % sys.argv[0]) exit(-1) with open(file, "rb") as f: buf = f.read() image_len = len(buf) if buf[:4] != b"rgba": print("not \"rgba\" image!") exit(-1) image = Image.new("RGBA", (WIDTH, HEIGHT), None) off = 4 curr_x = 0 curr_y = 0 while True: if off >= image_len: break if buf[off] == 0x13 and buf[off + 1] == 0x57: fill_len = struct.unpack("