I wrote a blog post giving an introduction to the PNG file format, aimed at anyone who wants to generate or parse their own PNGs (or who just wants to know how it works!)
https://www.da.vidbuchanan.co.uk/blog/hello-png.html
https://www.da.vidbuchanan.co.uk/blog/hello-png.html