Groups | Blog | Home
all groups > dotnet framework > april 2008 >

dotnet framework : determing file size of Bitmap object without saving it...


Peter Duniho
4/27/2008 4:50:09 PM
[quoted text, click to view]

How are you downloading it? The best way would be to be involved enough
in the download process itself so that you already know how large the data
is.

[quoted text, click to view]

Sure. You could save the Bitmap object to a MemoryStream instance instead
of to a file. Then you could look at how large the MemoryStream was.

I still think it would be better to just get the size as you're
downloading the data.

buu
4/27/2008 9:30:33 PM
how could I find file size of an bitmap object downloaded from an web site
without saving it to the disk (and using system.io.FileInfo)?

is there any way to create some kind of an byte array and read it's size?

JS
4/28/2008 4:20:09 AM
I'm not sure I understand your question. You can look at the width,
height, and pixel format of a bitmap object to figure out the
approximate size that the bitmap would have when saved (assuming that
the bitmap is saved without compression). If you need to get the size
as it's being received, you can see how a bitmap is stored by googling
these words: bitmap storage msdn. The headers will tell you the size
AddThis Social Bookmark Button