3 ms·
Sounds like you should use a compression tool that recognizes the content and recodes QOI as PNG on the fly, then zips it.
by amelius 5y ago
Sounds like you should use a compression tool that recognizes the content and recodes QOI as PNG on the fly, then zips it.
- dylan604 5y agoIf you've already encoded the content to the most effecient size, why then zip it?
- idontknowifican 5y agobecause the size of the download affects time to action
- makapuf 5y agoI would say zip is being used for tar-like functionality, but aiming Windows users.
- dylan604 5y agobut adding .zip extension doesn't make it friendly as an image format. I would never ever ever ever want to put <img src="imagename.zip"> into code any where. So if you're making a new image type that doesn't fit in a known image container, then create a new MIME type.
- wongarsu 5y agoThe PNG format basically boils down to "encode pixel values as the difference to previous pixels to make it more compressible, compress with deflate, add metadata". Zipping it won't improve on that. If you're willing to break compatibility anyways you could however improve PNG by substituting a better compression algorithm like zstd or lzma.
- antisthenes 5y agoZStd really seems like it should be the standard compression algorithm going forward from 2020.
- adgjlsfhk1 5y agoLZ4 is definitely worth using in some situations, but as far as I can tell, the two of them pretty much define the Pareto frontier.
- bscphil 5y agoThis is not true at all. PNG uses the DEFLATE algorithm which is a perfectly general algorithm for compressing data, it's not just a matter of encoding pixel differences. That's the real reason it doesn't make sense to zip a PNG - the internal data in the image is literally already zipped (the zip format uses DEFLATE). You are however correct that zstd would be a better algorithm than DEFLATE to be the basis of a modern image format - however, that sort of misses the point as well because there are modern techniques for encoding images losslessly that are much better than general data compression can achieve. JPEG-XL has a lossless mode that is "about 35% smaller than PNG" according to their website. That's almost certainly more than you would get out of switching to zstd, or even LZMA.
- bscphil 5y agoI apologize to wongarsu - I'm mildly dyslexic, and I missed the part of their comment where they mentioned that PNG uses DEFLATE, and leaving out that part totally changes the meaning of the comment. Their comment makes total sense after I happened to reread it.