硬汉嵌入式论坛

 找回密码
 立即注册
查看: 5314|回复: 1
收起左侧

[LibJPEG] 【LibJPEG专题系列四】JPEG压缩图像的效果

[复制链接]

740

主题

1326

回帖

3546

积分

管理员

春暖花开

Rank: 9Rank: 9Rank: 9

积分
3546
QQ
发表于 2015-4-8 17:51:42 | 显示全部楼层 |阅读模式
                                       JPEG 图像压缩 FAQ, part 1
Section - [4] How well does JPEG compress images?

Very well indeed, when working with its intended type of image (photographs and suchlike).  For full-
color images, the uncompressed data is normally 24 bits/pixel.  The best known lossless compression
methods can compress such data about 2:1 on average.  JPEG can typically achieve 10:1 to 20:1
compression without visible loss, bringing the effective storage requirement down to 1 to 2 bits/pixel.  
30:1 to 50:1 compression is possible with small to moderate defects, while for very-low-quality
purposes such as previews or archive indexes, 100:1 compression is quite feasible.  An image compressed
100:1 with JPEG takes up the same space as a full-color one-tenth-scale thumbnail image, yet it retains
much more detail than such a thumbnail.


For comparison, a GIF version of the same image would start out by sacrificing most of the color
information to reduce the image to 256 colors (8 bits/pixel).  This provides 3:1 compression.  GIF has
additional "LZW" compression built in, but LZW doesn't work very well on typical photographic data;
at most you may get 5:1 compression overall, and it's not at all uncommon for LZW to be a net loss (i.e.,
less than 3:1 overall compression). LZW *does* work well on simpler images such as line drawings,
which is why GIF handles that sort of image so well.  When a JPEG file is made from full-color
photographic data, using a quality setting just high enough to prevent visible loss, the JPEG will
typically be a factor of four or five smaller than a GIF file made from the same data.


Gray-scale images do not compress by such large factors.  Because the human eye is much more
sensitive to brightness variations than to hue variations, JPEG can compress hue data more heavily
than brightness (gray-scale) data. A gray-scale JPEG file is generally only about 10%-25% smaller
than a full-color JPEG file of similar visual quality.  But the uncompressed gray-scale data is only 8
bits/pixel, or one-third the size of the color data, so the calculated compression ratio is much lower.  
The threshold of visible loss is often around 5:1 compression for gray-scale images.


The exact threshold at which errors become visible depends on your viewing conditions.  The smaller
an individual pixel, the harder it is to see an error; so errors are more visible on a computer screen (at
70 or so dots/inch) than on a high-quality color printout (300 or more dots/inch). Thus a higher-
resolution image can tolerate more compression ... which is fortunate considering it's much bigger to
start with.  The compression ratios quoted above are typical for screen viewing.  Also note that the
threshold of visible error varies considerably across images.
努力打造安富莱高质量微信公众号:点击扫描图片关注
回复

使用道具 举报

740

主题

1326

回帖

3546

积分

管理员

春暖花开

Rank: 9Rank: 9Rank: 9

积分
3546
QQ
 楼主| 发表于 2015-4-8 17:54:56 | 显示全部楼层
                           Section 4JPEG压缩图像的效果?

    当处理预定类型的图像,比如照片或类似的,效果确实很好。对于全彩图像,未压缩时的数据通常是
每像素24位的。最熟知的无损压缩方法可以平均以大概2:1的压缩数据。JPEG通常可以达到10:120:1
压缩,同时没有可见的损失,而且还可以带来有效的存储要求——数据下降到每像素12位。达到30:1
50:1的压缩也是可能的,当然这将伴随着小至中等的缺陷,然而,对于非常低质量的目的,如预览或存档
的索引,1001的压缩也是相当可行的。用JPEG压缩到1001的图像会占用与一个全彩的十分之一规模
的缩略图相同的空间,但是它比缩略图会保留更多细节。


    为比较起见,相同图像的GIF版本将伴随大部分颜色信息的损失来将图像减少到256种颜色(即每像素
8位)。这提供了3:1的压缩。GIF有额外的“LZW”内置压缩,但是对于典型的摄影材料来说,LZW的效
果不是很好。最多你会得到5:1的整体压缩,而且这一点也不罕见因为LZW是净损失(也就是说,小于3:1
的整体压缩)。对于像线条画这样简单一点的图像,LZW的效果确实很好,这也就是为什么GIF能很好处
理此类图像的原因了。当一个JPEG文件是由全彩摄影数据组成,并且使用一个高到可以阻止可见损失的质
量设置时,JPEG通常比相同数据组成的GIF文件更小四分之一或五分之一。


        灰度图像不会这样大比率的压缩。因为人眼对于亮度的变化比色调的变化更敏感,相比压缩亮度(灰
度)数据,JPEG压缩色调的数据会更明显。一个灰度JPEG文件一般比一个相同视觉质量的全彩JPEG文件
只小大约10%25%。但是没有压缩的灰度数据只有每像素8位,或只有颜色数据的三分之一的大小,所有
压缩的比率要低很多。对于灰度图像,可见损失的阈值通常在5:1的压缩左右。


    确切的可见缺陷的阈值取决于你的观测条件。单个的像素越小,可以看到缺陷的难度越大。所以比起
一个高质量颜色的打印输出(300/英寸或更多),误差在电脑屏幕(70/英寸左右)上会更加明显。
所以,一个高分辨率的图像可以承受更大的压缩。上面引述的压缩比就是用于屏幕观看的典型。还要注意
的是,可见误差的阈值在不同图像之间会有很大的差别。
努力打造安富莱高质量微信公众号:点击扫描图片关注
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-12 18:34 , Processed in 0.166723 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表