Asked by:
Assigning dynamic bitmap to asp.net image control

Question
-
User1112880609 posted
Hi folks. Thanks in advance for your input.
This feels like a dumb question where I think I've figured out the hard part, but can't figure out the easy part.
When my page loads, I dynamically create a bitmap (a graph) based on some input pulled from a database. I want to display this bitmap on my page (which contains a bunch of statistics and things like that).
I can get the bitmap to display by using the following code (where bmp is the bitmap object):
Page.Response.ContentType = "image/jpeg"
bmp.Save(Page.Response.OutputStream, ImageFormat.Gif)
However, this just displays the bitmap on a blank page.
What I really want to do is assign the bitmap to an image control directly (which is sitting nicely in a table with various other labels and data). I really don't want to have to save the bitmap to a file, then assign that file to the imgControl.imageURL, then load that file.
Is there a way to directly assign a bitmap to an image control?
Thanks
Dave Hunt
Wednesday, January 25, 2006 3:52 PM
All replies
-
User-1372641848 posted
NO its not possible.
Check this post http://forums.asp.net/1168189/ShowPost.aspx#1168189
Thursday, January 26, 2006 8:23 AM -
User-413053108 posted
Actually, you can:
Let's assume image.aspx has the code to display the image (the way you did it).
Then on you display page:
protected void Page_Load(object sender, EventArgs e)
{
Image1.ImageUrl = "image.aspx";
}
This way, the Image1 control will load the page as an image. You can even pass parameters to the file to draw the image differently.
Thursday, February 9, 2006 1:40 PM -
User-1372641848 posted
User is asking if he can assign bitmap directly to image his question is.
"Is there a way to directly assign a bitmap to an image control?"
Friday, February 10, 2006 7:56 AM -
User-1377142270 posted
Cheers I've been looking for code to do that for ages. The hardest things are always simple :)
Monday, March 13, 2006 10:29 AM -
User-2103477710 posted
You can do this using a DynamicImageControl.
See http://msdn.microsoft.com/msdnmag/issues/04/04/CuttingEdge/ for more information.
Tuesday, March 21, 2006 11:44 AM