对于JPEG大小是8px还是16px的倍数,有质量,文件大小或其他好处吗? [英] Is there a quality, file-size, or other benefit to JPEG sizes being multiples of 8px or 16px?

查看:1221
本文介绍了对于JPEG大小是8px还是16px的倍数,有质量,文件大小或其他好处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JPEG压缩编码过程将给定图像分割成8x8像素的块,在将来的有损和无损压缩中使用这些块。 [来源]



还提到,如果图像是多个1MCU块(定义为最小编码单元,通常在两个方向上为16个像素),则可以执行对JPEG的无损变更。 [来源]



我正在处理产品图片,并想知道是否,以及在我的最终图片大小(例如,使用大小为480像素×360像素的图像)中使用16的倍数与非倍数16(例如484x362)。在这个例子中,我不想进一步修改,编辑或重新压缩最终的图片。



为了更接近一个特定的答案,我知道必须主要是一般性:给定一个480x360的图片,其大小为64k,并在Photoshop中以最高质量保存 [example]




  • 我可以预期图片的质量损失为484x362


  • 增长大于8px网格还有其他缺点吗?



我知道使用那个特定的例子是任意的,但它仍然是有用的(对我和潜在的任何其他思考图像大小)来了解什么级别的妥协我在打破非8px网格处理。



这里的关键问题是辩论我已经是8像素可分割的图像是否更高的质量不能被8像素整除的图像。

解决方案

8像素是截止。原因是因为JPEG图像仅仅是8×8 DCT块的阵列;如果图像分辨率在两个方向上都不是mod8,则编码器必须将边填充到下一个mod8分辨率。这在实践中不是非常昂贵的位方式;更糟糕的是,当图像具有不位于块边界上的锐利的黑线(例如信箱图像)时的情况。这在视频编码中尤其成问题。这是一个问题的原因是,尖锐线的频率变换是系数的高斯分布 - 导致大量的位要编码。



对于那些好奇的,在帧内压缩(例如JPEG图像)中填充边缘的最常见的方法是在边缘之前镜像像素线。例如,如果需要填充三条线并且线X是边缘,则线X + 1等于线X,线X + 2等于线X-1,并且线X + 3等于线X- 2。这在相当有效地最小化额外线的变换系数的成本。然而,在帧间编码中,填充算法通常简单地复制最后一行,因为镜像方法对于视频压缩等帧间压缩效果不佳。


The JPEG compression encoding process splits a given image into blocks of 8x8 pixels, working with these blocks in future lossy and lossless compressions. [source]

It is also mentioned that if the image is a multiple 1MCU block (defined as a Minimum Coded Unit, 'usually 16 pixels in both directions') that lossless alterations to a JPEG can be performed. [source]

I am working with product images and would like to know both if, and how much benefit can be derived from using multiples of 16 in my final image size (say, using an image with size 480px by 360px) vs. a non-multiple of 16 (such as 484x362). In this example I am not interested in further alterations, editing, or recompression of the final image.

To try to get closer to a specific answer where I know there must be largely generalities: Given a 480x360 image that is 64k and saved at maximum quality in Photoshop [example]:

  • Can I expect any quality loss from an image that is 484x362
  • What amount of file size addition can I expect (for this example, the additional space would be white pixels)
  • Are there any other disadvantages to growing larger than the 8px grid?

I know it's arbitrary to use that specific example, but it would still be helpful (for me and potentially any others pondering an image size) to understand what level of compromise I'd be dealing with in breaking the non-8px grid.

The key issue here is a debate I've had is whether 8-pixel divisible images are higher quality than images that are not divisible by 8-pixels.

解决方案

8 pixels is the cutoff. The reason is because JPEG images are simply an array of 8x8 DCT blocks; if the image resolution isn't mod8 in both directions, the encoder has to pad the sides up to the next mod8 resolution. This in practice is not very expensive bit-wise; what's much worse are the cases when an image has sharp black lines (such as a letterboxed image) that don't lie on block boundaries. This is especially problematic in video encoding. The reason for this being a problem is that the frequency transform of a sharp line is a Gaussian distribution of coefficients--resulting in an enormous number of bits to code.

For those curious, the most common method of padding edges in intra compression (such as JPEG images) is to mirror the lines of pixels before the edge. For example, if you need to pad three lines and line X is the edge, line X+1 is equal to line X, line X+2 is equal to line X-1, and line X+3 is equal to line X-2. This quite effectively minimizes the cost in transform coefficients of the extra lines.

In inter coding, however, the padding algorithms generally simply duplicate the last line, because the mirror method does not work well for inter compression, such as in video compression.

这篇关于对于JPEG大小是8px还是16px的倍数,有质量,文件大小或其他好处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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