Apple screenshot PNGs contain non-standard chunk
I did some idle poking around in the PNG file format, and found something weird.
Here’s the gist.
I read up just enough on the .PNG standard to get a sense of how the data is structured. The first few bytes in the file are the same on every PNG, followed by a series of “chunks” that are structured the same way.
Each chunk has a chunk type, which is one of set of predefined chunks, such as IHDR for the image header, and IDAT for the image data. I wrote a simple loop to run through each chunk and print out the chunk type and its length in bytes.
Oddly enough, the .PNG I was using to test out my code had a chunk type that wasn’t documented: iDOT. Here’s the out (note that because there are so many IDAT chunks in a given file, I just print the number and combined size at the end, or else the terminal output would just be way too long.):