473,537 Members | 2,672 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 11134
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
4819
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
31775
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
4130
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
2574
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
11604
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
1751
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
5392
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
7300
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...
1
7277
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
7644
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
5826
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
5219
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
4846
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...
0
3347
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...
0
3343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
582
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.