By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,811 Members | 785 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,811 IT Pros & Developers. It's quick & easy.

Image Manipulations (how to set legends)

P: n/a

I need to set several legends to an bmp Image.
The legends must be set all around of the image (each 30 degrees).
I really need your help about this topic.
The best would be to get a vb solution :)


Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Stan -

Here's an example. The one thing I think you'll need to play with is
the positioning of the point (last parameter of the DrawString
function). If you saved this as Image.aspx, you could display it on
another page with <img src="image.aspx?Legend=Sample">.

<%@ Page Language="VB" ContentType="image/jpeg" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Text" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>

Response.Clear( )
Dim Legend as String

If Request.QueryString("Legend") = Nothing Then
Legend = ""
Legend = Request.QueryString("Legend")
End If

Dim bmp as Bitmap = Image.FromFile("Input.bmp")
Dim g as Graphics = Graphics.FromImage(bmp)

g.DrawString(Legend, _
New Font("Arial", 12, FontStyle.italic), _
SystemBrushes.WindowText, New PointF(100,100))

bmp.Save(Response.OutputStream, ImageFormat.Jpeg)
g.Dispose( )
bmp.Dispose( )
Response.End( )


- Jon

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.