> Lossless ones are basically just ZIP,
Let's go down one more level of abstraction, it's crucial for understanding why it's byte-level patterns: Deflate, not ZIP. See http://www.libpng.org/pub/png/spec/1.2/PNG-Compression.html.
> image compression algorithms are generally terrible at finding patterns.
The core of deflate is pattern recognition, inter alia:
- Duplicate series of bytes (a pattern of repeated bytes in series).
- Huffman coding (a pattern of high frequency repeated bytes that could be replaced by another repeated byte string)
See https://en.wikipedia.org/wiki/Deflate
> There are certain patterns that PNG can efficiently detect, like repeating pixels from the line above
PNG uses deflate. General byte-level patterns. It does not do bespoke image-specific stuff.
> This is certainly entirely explained by the chosen (in this case, default) compression level of the ZIP file and PNG files.
Probably.