PC Review


Reply
Thread Tools Rate Thread

How do I get the file size of an image?

 
 
Stu
Guest
Posts: n/a
 
      22nd Jul 2003
Hi,

I have opened an image using the code below. I can read the physical
dimesions of the image but I need to get the file size.

Dim img As System.Drawing.Image
img = System.Drawing.Image.FromFile("C:\MyImage.jpg")

I need to do it without looking at the file system as I am going to be doing
some basic compression on the fly, and allowing the user to select the one
with the lowest file size that looks OK.

Thanks in advance.

Stu


 
Reply With Quote
 
 
 
 
Stu
Guest
Posts: n/a
 
      22nd Jul 2003
Hi,

The idea is that I want to display a list of 6 or so images with differing
levels of compression. I then want the user to select the one with the
lowest file size that is good enough quality. I could write all the files to
a temp folder on the hard drive and then just point to those but I would
rather do it in memory.

Is there any way to count the number of bits/bytes in an image object?
If it HAS to be done using the file system...how do you do it?

Thanks in advance,

Stu

"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> You want to get the file size without using the file system? If you want

to
> get the FILE size, you're going to have to look at the FILE.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Big things are made up of
> lots of little things.
>
> "Stu" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I have opened an image using the code below. I can read the physical
> > dimesions of the image but I need to get the file size.
> >
> > Dim img As System.Drawing.Image
> > img = System.Drawing.Image.FromFile("C:\MyImage.jpg")
> >
> > I need to do it without looking at the file system as I am going to be

> doing
> > some basic compression on the fly, and allowing the user to select the

one
> > with the lowest file size that looks OK.
> >
> > Thanks in advance.
> >
> > Stu
> >
> >

>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reduce image file size shapper Microsoft C# .NET 1 18th Oct 2009 06:47 PM
How to reduce image file size? =?Utf-8?B?UGFycm90?= Microsoft ASP .NET 11 13th Apr 2006 04:07 PM
Optimizing file size of an image? slavinger@yahoo.com Microsoft C# .NET 4 22nd Jul 2005 09:35 PM
Image file size? Pinecone Storage Devices 9 24th Nov 2004 06:07 PM
Still Image File Size for HDTV Ralph Tomaccio Windows XP MovieMaker 5 7th Oct 2004 03:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:17 PM.