473,546 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Image Control to Bitmap

Hello All, want to be able to pull images from the database and load them
into a bitmap through a stream which I have working. I then want to take
the bitmap and load it into a Image control without haveing to save the
bitmap as a file. Is this possible? Currently, I just display the bitmap
by calling Bitmap.save however, if users do not know to click the image they
can not see the full size. If I can create a bitmap from the stream I know
the size so I can set the properties of a image control and then display the
bitmap in the image. Does this make since or am I going about this the
wrong way? So in a nutshell, I am pulling images from a DB and want to
display the full size without having to actuall save the image to a file.
Any pointers?

TIA
Aug 13 '07 #1
4 11135
You can make an mypage.aspx page that returns bitmap (not HTML)
1. You need to set ContentType = "img/gif"; or (jpg)
2. You need to set ContentLength to the size of the image
3. Use Response.Binary Write to output the image. Or since Response is a
Stream you can do Bitmap.Save(Res ponse);

in your HTML you write <img src="mypage.asp x">
PS: It's more efficient to use handler for that task. mypage.ashx. But aspx
will work too if you fill more comfortable with aspx.

George.

"MikeB" <m@nospam.comwr ote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
Hello All, want to be able to pull images from the database and load them
into a bitmap through a stream which I have working. I then want to take
the bitmap and load it into a Image control without haveing to save the
bitmap as a file. Is this possible? Currently, I just display the bitmap
by calling Bitmap.save however, if users do not know to click the image
they can not see the full size. If I can create a bitmap from the stream
I know the size so I can set the properties of a image control and then
display the bitmap in the image. Does this make since or am I going about
this the wrong way? So in a nutshell, I am pulling images from a DB and
want to display the full size without having to actuall save the image to
a file. Any pointers?

TIA

Aug 13 '07 #2
Here is a way to do this without relying on an external handler such as
another page:

http://www.eggheadcafe.com/articles/20050911.asp

-Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"MikeB" wrote:
Hello All, want to be able to pull images from the database and load them
into a bitmap through a stream which I have working. I then want to take
the bitmap and load it into a Image control without haveing to save the
bitmap as a file. Is this possible? Currently, I just display the bitmap
by calling Bitmap.save however, if users do not know to click the image they
can not see the full size. If I can create a bitmap from the stream I know
the size so I can set the properties of a image control and then display the
bitmap in the image. Does this make since or am I going about this the
wrong way? So in a nutshell, I am pulling images from a DB and want to
display the full size without having to actuall save the image to a file.
Any pointers?

TIA
Aug 14 '07 #3
Your page can have an Image control on it, and that Image control can point
to another page (or handler) that retrieves the image.
Here are the details:
http://SteveOrr.net/articles/ImproveYourImages.aspx
http://dotnetslackers.com/articles/a...ileDenial.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"MikeB" <m@nospam.comwr ote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
Hello All, want to be able to pull images from the database and load them
into a bitmap through a stream which I have working. I then want to take
the bitmap and load it into a Image control without haveing to save the
bitmap as a file. Is this possible? Currently, I just display the bitmap
by calling Bitmap.save however, if users do not know to click the image
they can not see the full size. If I can create a bitmap from the stream
I know the size so I can set the properties of a image control and then
display the bitmap in the image. Does this make since or am I going about
this the wrong way? So in a nutshell, I am pulling images from a DB and
want to display the full size without having to actuall save the image to
a file. Any pointers?

TIA
Aug 14 '07 #4
Thanks everyone for the replies.

"MikeB" <m@nospam.comwr ote in message
news:us******** ******@TK2MSFTN GP02.phx.gbl...
Hello All, want to be able to pull images from the database and load them
into a bitmap through a stream which I have working. I then want to take
the bitmap and load it into a Image control without haveing to save the
bitmap as a file. Is this possible? Currently, I just display the bitmap
by calling Bitmap.save however, if users do not know to click the image
they can not see the full size. If I can create a bitmap from the stream
I know the size so I can set the properties of a image control and then
display the bitmap in the image. Does this make since or am I going about
this the wrong way? So in a nutshell, I am pulling images from a DB and
want to display the full size without having to actuall save the image to
a file. Any pointers?

TIA

Aug 15 '07 #5

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

Similar topics

5
4824
by: Steve Amey | last post by:
Hi all I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by using the Color.ToArgb method), is there any way that I can create a System.Drawing.Image or a System.Drawing.Bitmap from that value? Regards, Steve
15
31777
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and help. Regards
10
4133
by: David W. Simmonds | last post by:
I have a DataList control that has an Image control in the ItemTemplate. I would like to resize the image that goes into that control. I have a series of jpg files that are full size, full resolution (ie. large). I have a database that contains references to the pictures. Currently I have to resize the jpgs manually, and then point the...
7
3377
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
2
2575
by: Jeronimo Bertran | last post by:
Hello, I am using a rendering aspx page to display a database image on an Image control. When the database record is retrieved, I am saving the bitmap to a session variable for the rendering aspx to load. Here is the code on the rendering page: CODE FOR ImageForm.aspx private void Page_Load(object sender, System.EventArgs e)
7
11608
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an...
3
1753
by: Dave | last post by:
Hey all, I have a problem and I can't find anything on the net to really address it. We have a program at work that has lots of numbers on the front of the form because it is a control program for a hydro plant. My boss would like me to create a web page so our control center can see all of the numbers but not have access to the actual...
1
5399
by: Ben | last post by:
Hi Ya, quick question for you. Im a little new to web controls and im trying to have a control that returns a bitmap image. So i have created a web control library, added a control, have the following public class MyImage : System.Web.UI.WebControls.Image
2
2795
by: Tina | last post by:
I have a System.Drawing.Bitmap myImage; I also have a webcontrols.Image on my web page. I want to put the bitmap into the image but the image can only get it's bitmap from ImageURL which can be a fileName or a webpage that writes. But I don't want to have to write my bitmap to a file, I just want to put it into the image. Can this be...
0
7504
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
7435
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
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
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...
0
7792
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...
1
5360
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
5080
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...
1
1921
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
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.