开发者

Get File Size of Modified Image Before Writing to Disk

I'm doing a conversion from .jpg to .png in System.Drawing and one thing that I've found is that this conversion tends to make the resulting converted .png much larger than the .jpg orig开发者_C百科inal. Sometimes more than 10x larger after converting to .png.

Given that seems to always be the case (unless you know of a way around this), is there any way to determine the file size of that .png before it is saved to disk? For example, maybe write it to a stream first and then get that stream size? How would I go about doing this?


You can write to a MemoryStream and calculate the size of it, then write it to the FileSystem.

Although: There might be a better way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜