473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 11117
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.BinaryWrite to output the image. Or since Response is a
Stream you can do Bitmap.Save(Response);

in your HTML you write <img src="mypage.aspx">
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.comwrote in message
news:us**************@TK2MSFTNGP02.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.comwrote in message
news:us**************@TK2MSFTNGP02.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.comwrote in message
news:us**************@TK2MSFTNGP02.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
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...
15
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...
10
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...
7
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
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...
7
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...
3
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...
1
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.