By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,435 Members | 2,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,435 IT Pros & Developers. It's quick & easy.

Image Dimensions

P: n/a
Is there any way to determine the dimensions of an image using the image's
URL?
ie load image based on URL, and then get dimensions? or perhaps better method?
Nov 16 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
MurrayTh wrote:
Is there any way to determine the dimensions of an image using the image's
URL?
ie load image based on URL, and then get dimensions? or perhaps better method?


I don't think you can get an image parameters until you get it(read - download it)
I think you can read just the header and then parsing it get the dimentions, but it's gonna be pain
in the a$$...
Nov 16 '05 #2

P: n/a
Using this library, call the GetBitmapFromUri method to get a Bitmap object,
which you can use to get the image's dimensions.

http://www.codeproject.com/cs/media/bitmapmanip.asp

--
Jon Sagara

"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Is there any way to determine the dimensions of an image using the image's
URL?
ie load image based on URL, and then get dimensions? or perhaps better

method?
Nov 16 '05 #3

P: n/a
http doesn't provide the images dimensions. It simply says what size to display the image on the client browser. To
accurately get the images size you need to get the image local and use the handy System.Drawing.Image class to extract
whatever info you need. Well most of it anyway.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Is there any way to determine the dimensions of an image using the image's
URL?
ie load image based on URL, and then get dimensions? or perhaps better method?


Nov 16 '05 #4

P: n/a
Carl,

Is there a way load the image as browser would using http, and use it to get
the dimensions for an image based on a URL, rather than a local file? The
images I need to refer to are not local. Would this use a Stream reader or
something? Not familiar enough with how to get this, as all stream readers
seem to read a file, not a URL.

"Carl Frisk" wrote:
http doesn't provide the images dimensions. It simply says what size to display the image on the client browser. To
accurately get the images size you need to get the image local and use the handy System.Drawing.Image class to extract
whatever info you need. Well most of it anyway.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
Is there any way to determine the dimensions of an image using the image's
URL?
ie load image based on URL, and then get dimensions? or perhaps better method?


Nov 16 '05 #5

P: n/a
Sorry I missed your reply back there. Just saw it now.

I would need to know more about the site you are attempting to get the image information from. Does the site actually
display the image or a thumbnail of the image? .ASP? ASP.NET? The URL won't usually have image data in it, unless you
have control over the site and can embed it in Meta Data or something like that. Or in a hidden input. Otherwise you
will have to download the image to get it's internal data.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
Carl,

Is there a way load the image as browser would using http, and use it to get
the dimensions for an image based on a URL, rather than a local file? The
images I need to refer to are not local. Would this use a Stream reader or
something? Not familiar enough with how to get this, as all stream readers
seem to read a file, not a URL.

"Carl Frisk" wrote:
http doesn't provide the images dimensions. It simply says what size to display the image on the client browser. To
accurately get the images size you need to get the image local and use the handy System.Drawing.Image class to
extract
whatever info you need. Well most of it anyway.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
> Is there any way to determine the dimensions of an image using the image's
> URL?
> ie load image based on URL, and then get dimensions? or perhaps better method?



Nov 17 '05 #6

P: n/a
Sorry I missed your reply back there. Just saw it now.

I would need to know more about the site you are attempting to get the image information from. Does the site actually
display the image or a thumbnail of the image? .ASP? ASP.NET? The URL won't usually have image data in it, unless you
have control over the site and can embed it in Meta Data or something like that. Or in a hidden input. Otherwise you
will have to download the image to get it's internal data.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
Carl,

Is there a way load the image as browser would using http, and use it to get
the dimensions for an image based on a URL, rather than a local file? The
images I need to refer to are not local. Would this use a Stream reader or
something? Not familiar enough with how to get this, as all stream readers
seem to read a file, not a URL.

"Carl Frisk" wrote:
http doesn't provide the images dimensions. It simply says what size to display the image on the client browser. To
accurately get the images size you need to get the image local and use the handy System.Drawing.Image class to
extract
whatever info you need. Well most of it anyway.

--
....Carl Frisk
Anger is a brief madness.
- Horace, 20 B.C.
http://www.carlfrisk.com
"MurrayTh" <Mu******@discussions.microsoft.com> wrote in message
news:4B**********************************@microsof t.com...
> Is there any way to determine the dimensions of an image using the image's
> URL?
> ie load image based on URL, and then get dimensions? or perhaps better method?



Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.