Basically my question is like this one, but from PNG instead of JPEG.
More specifically, I have a bunch of PNG images concatenated together and I want to discover their lengths, so I can split the stream in pieces corresponding to individual images.
I do not need to decode or validate the images. I can assume that the input stream is composed of valid PNG images and do not want to verify that. Instead, it is useful for me to do this as quickly as possible, so the less amount of decoding operations are required, the better.