如何创建固定大小的文件? [英] How to create a fixed-size file?

查看:348
本文介绍了如何创建固定大小的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想创建JPEG files,它需要为fixed size,例如500KB.但是我不知道如何实现这一目标.谁能教我如何做?或喜欢使用一些工具?

P.S如何获取最小尺寸的JPEG文件?最小的JPEG文件是什么?

Hi,

I want to create JPEG files which requires to be fixed size, e.g 500KB. But I have no idea how to achieve that. Who can teach me how to make it?? or like use some tools?

P.S How to get the smallest size file of JPEG? What is the minimum JPEG files?

推荐答案

编写文件,检查其大小,如果小于500K,则在末尾添加所需数量的零字节.如果大于500K,则您遇到问题.
Write the file, check its size and if less than 500K add the requisite number of zero bytes to the end. If greater than 500K you have a problem.


无论您说什么,我都确信错误是拥有500KB的要求,应该将其删除.
我已经评论说这是不可能的.您可以填充较小的文件,但不能保证较小的文件.

在一般情况下,这理论上是不可能的.

尝试证明我错了.

—SA
Whatever you say, I''m sure that the mistake is the requirement to have 500KB and should be removed.
I already commented that this is impossible; your can pad smaller file but never guarantee smaller file.

In general case this is theoretically impossible.

Try to prove me wrong.

—SA


由于jpeg中使用了压缩算法,因此这可能是不可能的.
This is probably impossible to do due to the compression algo''s used in jpeg.


这篇关于如何创建固定大小的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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