Search code examples
imagepngdecoding

What is four bytes in png after each section


I'm trying to figure out the PNG format using the following image as an example:

enter image description here

A different PNG image's hex representation looks like this:

enter image description here

Between the sections IHDR-sRGB (0f d8 e5 b7 00 00 00 01) and PLTE-IDAT (01 a3 15 58 00 00 00 0c) we have 8 bytes each. If we assume that among these four are the CRC bytes, then what are the other four bytes?


Solution

  • Each chunk is a four-byte length, a four-byte ID, the data, and four-byte CRC. So your IHDR chunk CRC is 0f d8 e5 b7, and the next four bytes, 00 00 00 01 is the length of the data content of the sRGB chunk.