4 ms·
While definitely cool, I wonder how effective this is. Code/random binary data should have different characteristics than image data.
by jfries 8y ago
While definitely cool, I wonder how effective this is. Code/random binary data should have different characteristics than image data.
- onion2k 8y agoIt's very effective, because it means you get a really good compression algorithm for free (because it's already there in the browser). You definitely won't save enough bytes with better input heuristics than the amount of code needed to decompress them if you're only working with 13Kb of data.
- boomlinde 8y agoDEFLATE, which is used by PNG, is a general purpose LZ77-like compression algorithm suitable for all kinds of repetitive data.
- tialaramex 8y agoPNG filters each horizontal line of the image data before running it through Deflate, with a pre-processing step. Each of the possible filters is very simple, but the difference between a great PNG exporter, a mediocre one, and a trash fire is the use of a heuristic to decide which of the pre-processing filters should be applied to each line of output. libpng, the free implementation, includes a heuristic that does a fairly OK job, if you just don't implement a heuristic and use no filtering at all, the results are enormous PNG files as seen in turn of the century Adobe Photoshop. So, no, a general purpose compression algorithm isn't very good for image data on its own. (Choose for yourself whether you think Adobe wanted to discourage use of a popular free image format in favour of licensed formats for which it held relevant IP, or their development team are just incompetent morons, or both).
- boomlinde 8y ago> PNG filters each horizontal line of the image data before running it through Deflate, with a pre-processing step. Yes, as a means of making the data fed into the compressor repetitive enough to benefit from the compression algorithm. > So, no, a general purpose compression algorithm isn't very good for image data on its own. That's not what I said.