471,092 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

Image Dimensions

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
6 9746
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
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
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
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
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
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.

Similar topics

3 posts views Thread by dave | last post: by
8 posts views Thread by Abs | last post: by
1 post views Thread by John | last post: by
14 posts views Thread by D. Alvarado | last post: by
4 posts views Thread by chrisse_2 | last post: by
1 post views Thread by johnrees | last post: by
2 posts views Thread by Adam Teale | last post: by
6 posts views Thread by Samuel | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.