Get File Size of Modified Image Before Writing to Disk

Posted by Otaku on Stack Overflow See other posts from Stack Overflow or by Otaku
Published on 2010-06-17T16:54:38Z Indexed on 2010/06/17 17:03 UTC
Read the original article Hit count: 178

Filed under:
|
|
|

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 original. 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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about images