473,544 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9887
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 GetBitmapFromUr i 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******@discu ssions.microsof t.com> wrote in message
news:4B******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:4B******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:4B******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:A7******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:4B******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:A7******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:4B******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11742
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem...
8
9433
by: Abs | last post by:
Hi! I have an image inside a DIV box with its dimensions specified. The problem is that I don't know the dimensions of the image beforehand, therefore the image grows outside the box if it's bigger than the box. Is there a way to force the image to resize itself automatically to fit the box with CSS ? Thanks in advance
5
2086
by: John | last post by:
I am rotating images at one location of my web site. My problem is if I set the width and height of the new image before I show the new image, the old image is stretched first to the new image dimensions, and if I show the new image before setting its dimensions, the new image is stretched first to the old image dimension before it is...
1
2054
by: John | last post by:
I am rotating images of different dimensions. My problem is that when a new image is displayed in a new position which had an image of a different dimension, the old image is first stretched to the dimension of the new image, before the new image is loaded. How can I stop this stretching behavior? See the banner images on the right at...
14
11030
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin =...
4
5720
by: chrisse_2 | last post by:
Hey, Sorry about all the image posts its just that i need to get this to work!!! - I've already posted about the CanShrink and CanGrow option for image controls. This is a no go! What if i create another field, in the table with the images, which has the dimensions of each image, is there any code i can write in the report to change the...
1
2488
by: johnrees | last post by:
I am building a photo gallery using code which creates thumbnails of a specific size from any image. When clicked the thumbnail expands dynamically to a pre-determined size. The sizes of the thumbnails and the enlarged image are set via variables. To work properly, all the original images must be the same dimensions which means a great deal of...
2
4112
by: Adam Teale | last post by:
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this: http://www.pythonware.com/library/pil/handbook/introduction.htm but it looks like it is something I will need to install - I'd like to be able to pass my script around to people without them...
6
1658
by: Samuel | last post by:
Hi I use the image controls to show images but it distorts the image if the image dimensions are different to the image itself Thank you, Samuel
0
7429
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7368
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7777
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7384
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5916
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5301
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3414
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1844
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.