Image Formats
http://www.html5rocks.com/en/tutorials/speed/img-compression/
https://developers.google.com/speed/webp/
Image Formats
An image format typically chains together various lossy + lossless algorithms to grant compression savings. There’s multiple formats adopted by web browsers, each with different features and performance tradeoffs. To be clear, there’s not a “one size fits all” format for the web (currently). Different types of images should be encoded into different formats depending on what type of image it is, what the browser supports, and what needs the page has.
There’s typically three decisions that go into the choice of an image format for a web developer.
- Does it need transparency?
- Does it need animation?
- Does it need high quality data?
'Lena' is a common image used in the evaluation and comparision of image compression algorithms. |
PNG is a simple format that supports transparency and lossless compression. It allows you to define an alpha channel for your image, to mask out transparent areas, as well as an option to enable a lossless Deflate compressor on the data. (Deflate is a combination of two lossless compressors, LZ77, and Huffman). Because compression is lossless, image quality remains identical to the source image, this causes issues however, in that the file sizes tend to be quite bloated, and not as small as they could be.
GIF is another format which supports transparency, alongside animation (which is the direct reason for the whole ‘cats on the internet’ thing..). The GIF format contains two stages of compression, a lossy palletization step (restricting the entire image to only 256 colors) followed by a lossless LZW compressor. The process of quantizing the colors of the image down to only 256 provides an aggressive quality reduction at the benefit of better compression sizes, which tends to produce better compression from the LZW end of things.
Colt McAnlis says: Most modern, cutting edge compressors make the largest wins by chaining together multiple coding steps. A single stage can modify the data stream such that subsequent stages can compress it better than the raw data stream alone. Popular encoders, like 7zipchain together LZ dictionary encoding, that produces a reduced set of symbols that can be consumed more efficiently by a Markov Chain algorithm.
Or, for example, you can apply a lossless compression algorithm on top of an existing, GPU formatted lossy format to encode the data even further. The biggest wins come from combining algorithms in the right ways.
If you don’t need transparency, or animation, then JPG is the best format for you. It was generally designed to handle the compression of high-quality photo data, but provides a configurable set of Lossy compression options, allowing you to trade off compression quality vs. image size as your application needs it.
If you’re looking for more of a ‘one stop shop’ for your image format, then WebPshould be on your radar. The format boasts not only superior compression quality/size, but also transparency and animations as well. It uses both a lossy and lossless compressor combination, and much like JPG, will allow you to define your quality level vs. file size. Of course, this new image format hasn't been adopted across all browsers just yet, so web developers who’ve adopted it are currently in the early phases of working through usability issues. Although a 30% savings over JPG, alongside increased server-side adoption prove that WebP is a dominant format for any sites dealing with image bloat problems.
Compression | Lossless | Lossy | Transparency | Animation | |
PNG | Good | Yes | No | Full | No |
GIF | OK | Yes | Yes | Binary | Yes |
JPG | Good | Yes | Yes | No | No |
WebP | Great | Yes | Yes | Full | Yes |
Figure 3 - Feature set for specific browser supported formats
WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.
Lossy WebP compression uses predictive coding to encode an image, the same method used by the VP8 video codec to compress keyframes in videos. Predictive coding uses the values in neighboring blocks of pixels to predict the values in a block, and then encodes only the difference.
//predictive coding
小结:
0-预测式、前瞻式、个性化压缩。
发问:
0-编码,字符串替换,abc-MAP-a?
Image Formats的更多相关文章
- 【原创】开源Math.NET基础数学类库使用(05)C#解析Delimited Formats数据格式
本博客所有文章分类的总目录:[总目录]本博客博文总目录-实时更新 开源Math.NET基础数学类库使用总目录:[目录]开源Math.NET基础数学类库使用总目录 前言 ...
- Cannot load supported formats: Cannot run program "svn": CreateProcess error=2
svn CreateProcess error=2, 系统找不到指定的文件 IntelliJ IDEA 13.1.2安装后,SVN checkout时候会出现如下错误: Cannot load sup ...
- [BTS] Correct the specified Action, or refer to the documentation on the allowed formats for the Actions
A message sent to adapter "WCF-SAP" on send port "CNILG.iHouse.SAP.WCFSAP" with ...
- (转)Aspone.Cells设置Cell数据格式 Setting Display Formats of Numbers and Dates
Setting Display Formats Using Microsoft Excel: Right-click on any desired cell and select Format Cel ...
- 17.1.2 Replication Formats
17.1.2 Replication Formats 复制格式 17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Bas ...
- 17.1.2?Replication Formats 复制格式:
17.1.2?Replication Formats 复制格式: 17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Ba ...
- 14.9.4 COMPACT and REDUNDANT Row Formats
14.9.4 COMPACT and REDUNDANT Row Formats InnoDB 早期的版本 使用一种未命名的文件格式(现在称为Antelope(羚羊)) 对于数据库文件 在这种文件格式 ...
- 14.9 InnoDB Row Storage and Row Formats InnoDB 行存储和行格式:
14.9 InnoDB Row Storage and Row Formats InnoDB 行存储和行格式: 14.9.1 Overview of InnoDB Row Storage 14.9.2 ...
- 14.8.1 Enabling File Formats
14.8 InnoDB File-Format Management 14.8.1 Enabling File Formats 14.8.2 Verifying File Format Compati ...
随机推荐
- 使用iterator出现的死循环
public static void main(String[] args) { List<String> list = new ArrayList<String>(); li ...
- 构造图 Codeforces Round #236 (Div. 2) C. Searching for Graph
题目地址 /* 题意:要你构造一个有2n+p条边的图,使得,每一个含k个结点子图中,最多有2*k+p条边 水得可以啊,每个点向另外的点连通,只要不和自己连,不重边就可以,正好2*n+p就结束:) */ ...
- POJ1155 TELE(树形DP)
题目是说给一棵树,叶子结点有负权,边有正权,问最多能选多少个叶子结点,使从叶子到根的权值和小于等于0. 考虑数据规模表示出状态:dp[u][k]表示在u结点为根的子树中选择k个叶子结点的最小权值 最后 ...
- 超级楼梯[HDU2041]
超级楼梯 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- POJ 2217 (后缀数组+最长公共子串)
题目链接: http://poj.org/problem?id=2217 题目大意: 求两个串的最长公共子串,注意子串是连续的,而子序列可以不连续. 解题思路: 后缀数组解法是这类问题的模板解法. 对 ...
- CentOS 多网卡绑定bonding
1.查看环境 ip a |grep -v lo 2.加载bonding模块 modprobe bonding 3.开机自动加载模块到内核 echo 'modprobe bonding &> ...
- [Leetcode] Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. ...
- 【BZOJ】1019: [SHOI2008]汉诺塔
http://www.lydsy.com/JudgeOnline/problem.php?id=1019 题意:汉诺塔规则,只不过盘子n<=30,终点在B柱或C柱,每一次移动要遵守规则:1.小的 ...
- USACO 5.4 Character Recognition(DP)
非常恶心的一题,卡了三个月,没什么动力做了,代码直接抄的别人的... 这题主要思路就是预处理出几个数组,再预处理出几个数组,最后DP,输出一下路径... 写起来挺非常麻烦,代码不贴了,丢人... 把U ...
- Java_解决java.security.cert.CertificateException: Certificates does not conform to algorithm constraints
找到 jre/lib/security/java.security 将 jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048 ...