如何调整图片到一个特定的文件的大小? [英] How to resize a picture to a specific file size?
本文介绍了如何调整图片到一个特定的文件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想调整画面,以特定的文件大小。例如,不超过200KB更多。 什么是用C#.NET实现这一目标的最佳方法?
I would like to resize a picture to a specific file size. For example, no more than 200KB. What is the best approach to achieve this with C# .NET ?
谢谢!
推荐答案
如果你仔细想想,你是不会知道的图像文件大小它的调整之后。所以,你要么得进行尝试的连续迭代事后比较文件的大小,或者你可以改变你的约束图像限制为一组特定的高度和宽度尺寸。
If you think about it, you aren't going to know the filesize of the image until after it's resized. So you've either got to perform a successive iteration of attempts and compare the file sizes afterwards or you could change your constraints to restrict images to a particular set of height and width dimensions.
这篇关于如何调整图片到一个特定的文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文