gzip和png压缩中使用的DEFLATE是否相同? [英] Is DEFLATE used in gzip and png compression the same?

查看:102
本文介绍了gzip和png压缩中使用的DEFLATE是否相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解了gzip压缩和png图像压缩,它们都使用DEFLATE算法,但是我不确定该算法的实现是否相同.此外,如果算法相同,那么除了png压缩在DEFLATE之前使用增量过滤这一事实之外,这些压缩之间有什么区别?

I read about gzip compression and png image compression and they both use DEFLATE alghorithm, but I'm not sure that the implementation of that algorithm is the same. Also, if it's the same algorithm, then what is the difference between those compressions, besides the fact that png compression uses delta filtering before DEFLATE?

推荐答案

DEFLATE 是压缩数据 format ,而不是算法. gzip

DEFLATE is a compressed data format, not an algorithm. Both gzip and PNG use the deflate compressed data format exclusively, with different wrappers around that compressed data. Both can have multiple deflate streams.

gzip是一个命令行实用程序,带有 兼容DEFLATE的压缩程序的实现.编写gzip后的某个时候,写那个压缩器的那个人让·卢普·盖伊(Jean-loup Gailly)为 zlib 修改了该代码,通用压缩库.明确编写zlib是为了使图像能够采用PNG格式.大多数PNG压缩器都使用zlib.

gzip is a command-line utility with an implementation of a DEFLATE-compliant compressor. Sometime after gzip was written, the same person who wrote that compressor, Jean-loup Gailly, adapted that code for zlib, a general-purpose compression library. zlib was written expressly for the purpose of enabling the adoption of the PNG format for images. Most PNG compressors use zlib.

由于zlib的压缩代码改编自gzip的压缩代码,因此实现非常相似,但并不完全相同.如果使用gzip和zlib中的压缩代码压缩相同的数据,则通常会得到不同的结果,但输入内容较短.压缩器决定发出放气块的方式以及算法的调整参数都发生了变化.

As zlib's compression code was adapted from gzip's, the implementation is very similar, but not exactly the same. If you compress the same data with the compression code in gzip and zlib, you will generally get different results except for short input. There were changes in how the compressor decides to emit a deflate block, and in the tuning parameters of the algorithm.

这篇关于gzip和png压缩中使用的DEFLATE是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆