Jpeg 计算最大尺寸 [英] Jpeg calculating max size

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

问题描述

我不得不说我不太了解文件格式的工作原理.我的问题是说我有一个 200 像素 x 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天全站免登陆