On the Mac, raster files are stored in a different file format, suffixed .png.binltl. These files are neither PNG format nor are they encrypted.
The format of the file is as follows. Note that all data types are little-endian.
Offset | Datatype | Description |
---|---|---|
0x00 | unsigned 16-bit int | width of the final image |
0x02 | unsigned 16-bit int | height of the final image |
0x04 | unsigned 32-bit int | size of compressed data |
0x08 | unsigned 32-bit int | size of uncompressed data |
0x12 | ... | compressed image data |
The image data is compressed using zlib deflate. When uncompressed it is a stream of RGBA bytes in that order, so four bytes per pixel.
The actual dimensions of the uncompressed image are always square, with each side being a power of two. The dimensions are the smallest power-of-two square that completely encloses the actual source image (whose size appears in the header).
Thus, a 18x12 image would be stored in a 32x32 square, but a 512x512 image would be in a 512x512 square.
The square should be cropped to the image size specified in the header. Pixels outside these bounds have undefined values.