[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

determing file size of Bitmap object without saving it...

buu

4/27/2008 7:31:00 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?


2 Answers

Peter Duniho

4/27/2008 11:50:00 PM

0

On Sun, 27 Apr 2008 12:30:33 -0700, buu <aha@a.com> wrote:

> 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)?

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.

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

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.

Pete

JS

4/28/2008 11:20:00 AM

0

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
of the bitmap.