Re:Compressing Text into Images
by crazygringo on Sunday January 14, 2024 @01:38PM
(#38993084)
> PNG uses deflate. General byte-level patterns. It does not do bespoke image-specific stuff.
That's exactly what I meant, sorry if I wasn't clear. It's not "finding patterns in images". It's finding byte-level patterns, not visual (image) patterns -- which are inherently dimensional in a way that a stream of bytes isn't.
Which is why the post doesn't make any sense. Its entire premise is that there's something about lossless image compression which is different from zip/deflate and similar byte stream compression algorithms.
> PNG uses deflate. General byte-level patterns. It does not do bespoke image-specific stuff.
That's not quite the whole story. PNG does include simple filters to represent a line as a difference from the line above, and that may be what the original post is referring to. [1]
> 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.