PNG Fails After Compression? Check Its Multi-IDAT Stream
Split one zlib stream across two chunks to catch decoders that restart at each IDAT.


An image opens in a browser after recompression but fails in your asset importer. For a static PNG, check whether the importer treats each IDAT chunk as a separate zlib stream.
Change the packaging while preserving the data
Copy a small PNG with one IDAT. Split that chunk’s payload into two consecutive IDAT chunks: one byte in the first and the remaining bytes in the second makes a useful test. Give each chunk its own length and CRC. Calculate the CRC over the chunk type and payload, excluding the length. Leave the compressed bytes unchanged, and place no other chunk between the two parts.
Use both files to isolate the failure
- Concatenating the IDAT payloads should produce identical bytes in the two files. A working decoder should yield the same dimensions and pixels.
- If only the split file fails, check both lengths, both CRCs and chunk order. Then check whether the importer resets inflate at the second IDAT instead of continuing the stream.
- If an independent verifier rejects the split file too, repair the fixture first. If the importer fails on both, inspect the color type, filters and the first reported error.
Use the asset compression tool for a representative compressed asset, then check its chunk layout separately. The tool is not required to expose IDAT chunk controls. Keep this fixture to static PNG; APNG frame data has additional rules.
Ready to try "PNG Fails After Compression? Check Its Multi-IDAT Stream"?
Use our online tools to apply this tutorial to your indie game project right away.
