Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting from image to graphics and back again
Message
From
31/07/2007 18:21:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
Pictures and Image processing
Title:
Converting from image to graphics and back again
Miscellaneous
Thread ID:
01245045
Message ID:
01245045
Views:
53
I need to write text, e.g. "Copyright", on top of a photograph and then save the photo with the text embedded in it to a file and/or a database.
Dim Canvas As Graphics
Dim image1 As Bitmap

Canvas = Graphics.FromImage(Photo.Image)
Dim PhotoImage As Image
PhotoImage = Photo.Image

Dim GridColor As Color = Color.White
Dim GridBrush As New SolidBrush(GridColor)
Dim GridPen As New Pen(GridColor)
Dim GridFont As New Font("Verdana", 12, FontStyle.Bold)
Canvas.DrawString("Copyright", GridFont, GridBrush, 10, 10)

' Line below causes Graphics type cannot be converted to Bitmap error
image1 = Canvas
PhotoImage = image1

' Draw image to screen.
e.Graphics.DrawImage(image1, New PointF(0.0F, 0.0F))
As you can see, I tried using a bitmap as a transitional stage between an image and a graphics object, but that didn't work. What I think I need is a ToImage method that does the opposite of the FromImage method.

Any suggestions would be gratefully received,
David.
Next
Reply
Map
View

Click here to load this message in the networking platform