Image Manipulations (how to set legends)

  • Thread starter Thread starter Stan Sainte-Rose
  • Start date Start date
S

Stan Sainte-Rose

Hi,

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 :)

Stan
 
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 = ""
Else
Legend = Request.QueryString("Legend")
End If

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

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

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

%>

References:
http://www.wwwcoder.com/main/Default.aspx?tabid=68&mid=407&site=1727
http://www.codeproject.com/aspnet/aspnet_web_graphics.asp
http://www.syncfusion.com/FAQ/WinForms/FAQ_c3c.asp
http://www.bobpowell.net/faqmain.htm
- Jon
http://weblogs.asp.net/jgalloway
 
Back
Top