本文介绍了已知尺寸的JPEG图像的最大文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将允许用户上传使用JPEG压缩的300x300图像.有没有办法确定此类图像的最大文件大小?

I'm going to let users upload images of 300x300 compressed with JPEG. Is there a way to determine what the maximum file size of such an image would be?

我可以想象这可以通过以100质量压缩随机噪声来尝试,但是有理论上的最大值吗?

I can imagine this can be tried by compressing random noise at 100 quality, but is there a theoretical maximum?

假设图像是完全不可压缩的随机噪声,是否可以是每个像素3个字节(24位彩色)和元数据的余量?还是压缩后的图像会比原始图像大?

Say that the image is totally uncompressable random noise, could it be 3 bytes per pixel (24-bits colour) and a margin for the metadata? Or could such an image turn out larger than the original when compressed?

推荐答案

来自维基百科:

因此,对于300x300图像上的Q=100,将导致(300 * 300) px * 8.25 bits/px = 742,500 bits = ~ 93 kB

So, for Q=100 on an 300x300 image, that would result in (300 * 300) px * 8.25 bits/px = 742,500 bits = ~ 93 kB

还有无损的JPEG编码模式,实际上不使用.但它们将具有典型的RGB 24 bits/pixel.

There are also lossless JPEG coding modes, which are practically not used . But they would have the RGB typical 24 bits/pixel.

这篇关于已知尺寸的JPEG图像的最大文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-21 01:12
查看更多