473,800 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieving Image information

Is there anyway that I can obtain information about an image file such as a
..jpg before I display it onto a screen. In other words, I would like to
obtain the image size so I can dynamically place it on the screen. I like to
set the width and height values according to what the size of the image is. I
do not know whtat the size is at the time, because I will pick up the image
file to what the user wants displayed. I want to display that image correctly
as is...

Thanks in advance..
Nov 19 '05 #1
4 1278
This is one way:

Image i = Bitmap.FromFile (@"c:\myImage.j pg");
Console.WriteLi ne (i.Height.ToStr ing());
Console.WriteLi ne (i.Width.ToStri ng());
i.Dispose();

"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:AD******** *************** ***********@mic rosoft.com...
Is there anyway that I can obtain information about an image file such as a
..jpg before I display it onto a screen. In other words, I would like to
obtain the image size so I can dynamically place it on the screen. I like to
set the width and height values according to what the size of the image is.
I
do not know whtat the size is at the time, because I will pick up the image
file to what the user wants displayed. I want to display that image
correctly
as is...

Thanks in advance..
Nov 19 '05 #2
if you don't specify a height or width, the browser uses the actuals.

-- bruce (sqlwork.com)
"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:AD******** *************** ***********@mic rosoft.com...
Is there anyway that I can obtain information about an image file such as
a
.jpg before I display it onto a screen. In other words, I would like to
obtain the image size so I can dynamically place it on the screen. I like
to
set the width and height values according to what the size of the image
is. I
do not know whtat the size is at the time, because I will pick up the
image
file to what the user wants displayed. I want to display that image
correctly
as is...

Thanks in advance..

Nov 19 '05 #3
Joe
but the page can display quicker if the height and width are specified - it
can allocate the space before getting the image

"Bruce Barker" wrote:
if you don't specify a height or width, the browser uses the actuals.

-- bruce (sqlwork.com)
"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:AD******** *************** ***********@mic rosoft.com...
Is there anyway that I can obtain information about an image file such as
a
.jpg before I display it onto a screen. In other words, I would like to
obtain the image size so I can dynamically place it on the screen. I like
to
set the width and height values according to what the size of the image
is. I
do not know whtat the size is at the time, because I will pick up the
image
file to what the user wants displayed. I want to display that image
correctly
as is...

Thanks in advance..


Nov 19 '05 #4
true, but if you are using typical asp.net webforms, rendering performance
is not much of an issue, look at those viewstate sizes.

-- bruce (sqlwork.com)
"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:77******** *************** ***********@mic rosoft.com...
but the page can display quicker if the height and width are specified -
it
can allocate the space before getting the image

"Bruce Barker" wrote:
if you don't specify a height or width, the browser uses the actuals.

-- bruce (sqlwork.com)
"Angel" <An***@discussi ons.microsoft.c om> wrote in message
news:AD******** *************** ***********@mic rosoft.com...
> Is there anyway that I can obtain information about an image file such
> as
> a
> .jpg before I display it onto a screen. In other words, I would like to
> obtain the image size so I can dynamically place it on the screen. I
> like
> to
> set the width and height values according to what the size of the image
> is. I
> do not know whtat the size is at the time, because I will pick up the
> image
> file to what the user wants displayed. I want to display that image
> correctly
> as is...
>
> Thanks in advance..


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
5407
by: Don | last post by:
How do I retrieve the full path (C:\.....filename) of a file uploaded to a php script on the server. I think $_FILES will only provide 'name', which is only the filename itself. Thanks, Don ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =---
1
2001
by: Roman Kagan | last post by:
Hi everyone, I am successful in retrieving the image from the table (.TIF), however, the retrieved file does not work. It looks like an image file - extension, size and all, but the image is not visible. Any ideas? I'm including the first few lines (image opened with Notepad) of the file below. Please, help. """""
6
16133
by: Dean Slindee | last post by:
Does anybody have an actual example of retrieving an Image data type column from a SQL Server table using a dataset (not a datareader)? I would like to see the statements that would move the Image returned in the dataset to a picture box, like: For Each dr in ds.tables(0).rows Pic.Image = dr("ImageColumnName") 'not this simple! Next Thanks,
2
15726
by: Sakke | last post by:
Hello! We have written a GCryptoSvr.dll COM server in C++. Inside that resides WebClient COM component. WebClient CLSID is {8DC27D48-F94C-434B-A509-C3E1A3E75B9E}. When we are using that WebClient COM component from C++ code it works just fine. However when we try to use that same WebClient in the same machine with following C# code: using GCRYPTOSVRLib; WEBClient WC = new WEBClient();
7
2061
by: Sirplaya | last post by:
I am retrieving images that I stored in SQL Server on my web pages in C#. I have no problem with the images displaying, however, I am trying to wrap the image with an <A HREF ..." and each time I try, it acts like the link is not even on the image. What is the proper way to do this? Thanks.
2
3943
by: Bjorn Sagbakken | last post by:
This is kind of silly, but I just cannot figure out why: In ASP.NET 2.0 I am retrieving images from a MS SQL server, and writing them as binary to a separate page as the url for image controls, everything by the book. I have been doing this a lot with VB. Now I am writing a new application in C#, and the strange thng is this: - it works well in debug mode - but not on the published folder on the same server (localhost) - image frames...
1
2441
by: san123456789 | last post by:
Hi, Im using a MS SQL server to store images... Im creating a windows form application using C#. I need to store and retrieve images from the database. This is my code to store images: pictureBox.Image = new System.Drawing.Bitmap(this.openFileDialog.FileName);
0
1858
by: velmani | last post by:
hi , i have problem with Retrieving image from DB i have a table with image datatype i store a file by using code as follows -------------------------------------------------- string strType; int intLength,intStatus; Stream ipStream; intLength = File1.PostedFile.ContentLength; strType = File1.PostedFile.ContentType;
2
2253
by: shivapadma | last post by:
i have inserted the image into database using the following code String driverName = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/"; String dbName = "hibernatetutorial"; String userName = "root"; String password = "root";
0
9690
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10273
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10032
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7574
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.