Home All Groups Group Topic Archive Search About

can you convert an in-memory bitmap render in a web control image ?

Author
3 Jun 2005 5:19 PM
Support
Hello:

I have ...
Dim baseMap as Bitmap = new Bitmap(200, 50)
Dim myGraphic as Graphics = Graphics.FromImage(baseMap)
myGraphic.FillRectangle(HBrush, 0, 0, 200, 50)
BaseMap.Save(Response.OutputStream, ImageFormat.JPEG)
myGraphic.Dispose()
baseMap.Dispose()and I want to render the image either in a placeholder or
in an image control WIHOUT saving the BaseMap to file...Is there a way to do
that ?ThanksTerry

Author
3 Jun 2005 7:53 PM
vMike
Show quote Hide quote
"Support" <RemoveThis_Supp***@mail.oci.state.ga.us> wrote in message
news:Ou65wBGaFHA.3400@tk2msftngp13.phx.gbl...
> Hello:
>
>  I have ...
> Dim baseMap as Bitmap = new Bitmap(200, 50)
> Dim myGraphic as Graphics = Graphics.FromImage(baseMap)
> myGraphic.FillRectangle(HBrush, 0, 0, 200, 50)
> BaseMap.Save(Response.OutputStream, ImageFormat.JPEG)
> myGraphic.Dispose()
> baseMap.Dispose()and I want to render the image either in a placeholder or
> in an image control WIHOUT saving the BaseMap to file...Is there a way to
do
> that ?ThanksTerry
>
>
Sure, add an image to the placeholder and set its image src tag to an aspx
file that contains the above code with no body tag in the html. You will
also want to set the Response.ClearContent and  Response.ContentType =
"image/jpeg"

Mike
Author
3 Jun 2005 10:59 PM
Steve C. Orr [MVP, MCSD]
Yes, you'll need a special page (or an HTTPHandler) to handle the task,
though.
Here are the details:
http://SteveOrr.net/articles/ImproveYourImages.aspx

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


Show quoteHide quote
"Support" <RemoveThis_Supp***@mail.oci.state.ga.us> wrote in message
news:Ou65wBGaFHA.3400@tk2msftngp13.phx.gbl...
> Hello:
>
> I have ...
> Dim baseMap as Bitmap = new Bitmap(200, 50)
> Dim myGraphic as Graphics = Graphics.FromImage(baseMap)
> myGraphic.FillRectangle(HBrush, 0, 0, 200, 50)
> BaseMap.Save(Response.OutputStream, ImageFormat.JPEG)
> myGraphic.Dispose()
> baseMap.Dispose()and I want to render the image either in a placeholder or
> in an image control WIHOUT saving the BaseMap to file...Is there a way to
> do that ?ThanksTerry
>