已知尺寸的JPEG图像的最大文件大小

编程入门 行业动态 更新时间:2024-10-24 14:19:39
本文介绍了已知尺寸的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?

推荐答案

来自维基百科:

对于最高质量的图像(Q = 100),每个彩色像素大约需要8.25位 en.wikipedia/wiki/JPEG#Sample_photographs

For highest quality images (Q=100), about 8.25 bits per color pixel is required en.wikipedia/wiki/JPEG#Sample_photographs

因此,对于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 (last sentence, second paragraph). But they would have the RGB typical 24 bits/pixel.

更多推荐

已知尺寸的JPEG图像的最大文件大小

本文发布于:2023-11-01 12:02:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件大小   图像   尺寸   JPEG

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!