3 ms·
For pngs (and lossless encoding) the thing is that the last step of encoding is a run of the deflate algorithm. It's impossible to say what exactly a stream wil
by HeyImAlex 13y ago
For pngs (and lossless encoding) the thing is that the last step of encoding is a run of the deflate algorithm. It's impossible to say what exactly a stream will deflate down to without actually running your implementation of deflate. Possible encodings of an image pre-deflation are staggering, 5^height just for the filter step on all color types. I've been writing a brute force compressor (everything but the deflate step which depends on the implementation you choose) as a joke and it takes about an hour on images 10px high. For that reason encoders use heuristics to make best guesses whenever there's a choice to be made.
- HeyImAlex 13y agoOh and here's[1] a post I made about it. I decided to keep the project to myself as I'm making it into a more, uh, realistic png compressor, but that will give you an idea of all the possible descisions that need to be made while encoding. [1] http://heyimalex.com/journal/pngmassacre/ http://heyimalex.com/journal/pngmassacre/