JPEG计算最大大小 [英] Jpeg calculating max size

查看:245
本文介绍了JPEG计算最大大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不说,我对文件格式的工作原理不甚了解. 我的问题是说我有一个200像素乘200像素的jpeg文件,如何计算该文件的最大大小(以兆字节/字节为单位)?

I have to say the I don't know much about how file formats work. My question is say I have a jpeg file that is 200 px by 200 px, how can one calculate what the maximum size that file could be in terms of megabytes/bytes?

我认为,导致该问题的推理将帮助某个人回答我.我有一个Java Applet,人们用它绘制的上载图像到我的服务器上.我需要知道此文件可以达到的最大大小.总是200x200.

I think that the reasoning that led to the question will help some one answer me. I have a Java Applet the uploads Images that people draw with it to my server. I need to know what the max size that this file can conceivably reach. It is always going to be 200x200.

听起来有些愚蠢,但是否有比其他字节占用更多字节大小的颜色?如果是的话,最昂贵的颜色是什么?

It sounds dumb but are there colors that take more byte size then others and if so what is the most expensive one?

推荐答案

作为经验法则,没有JPEG会比等效大小的32位位图大.一个32位的位图在图像中每个像素将具有4个字节,因此将尺寸相乘(200x200 = 40000),然后将其乘以4个字节(40000x4 = 160000),您将有一个字节的上限-对于您的示例中,160000字节约为156kb.

As a rule of thumb, no JPEG is going to be larger than an equivalent size 32-bit bitmap. A 32-bit bitmap will have 4 bytes per pixel in the image, so multiply the dimensions together (200x200 = 40000), then multiply that by 4 bytes (40000x4 = 160000), and you'll have an upper bound in bytes - for your example, 160000 bytes is approximately 156kb.

这篇关于JPEG计算最大大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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