1 Attachment(s)
[2005] want Help in generating random images
hello all,
i m facing a problem in generating random images...
a ctually i wish to embade random text in certain image, for that i m using supporte methods by 'Image' type.. i m getting the result fine. but the problem is that i am not able to rotate the text any how.i am getting the staight forward text written in the image. instead of that i want something like this... [IMG]C:\Random1.jpg[/IMG]
Re: [2005] want Help in generating random images
sorry for the image tag. i wish i could show the sample image there ... but no prob. i hope the text could explain the scenario
Re: [2005] want Help in generating random images
What u can do is for each string do random rotation using
RotateTransform function
Enjoy..
VB Code:
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Drawing2D
// Windows Generated Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Clear()
Dim bmpimage As New Bitmap(250, 50, PixelFormat.Format24bppRgb)
Dim objimage As Graphics = Graphics.FromImage(bmpimage)
objimage.SmoothingMode = SmoothingMode.HighSpeed
objimage.Clear(Color.LightGreen)
objimage.TranslateTransform(29, 15)
[B] objimage.RotateTransform(23, MatrixOrder.Prepend)[/B] objimage.DrawString("p", New Font("Tahoma", 14, FontStyle.Regular), SystemBrushes.WindowText, New PointF(0, 0))
objimage.RotateTransform(-40, MatrixOrder.Prepend)
objimage.DrawString("A", New Font("Tahoma", 14, FontStyle.Regular), SystemBrushes.WindowText, New PointF(8, 0))
bmpimage.Save(Response.OutputStream, ImageFormat.Jpeg)
objimage.Dispose()
bmpimage.Dispose()
Response.End()
End Sub
End Class
1 Attachment(s)
Re: [2005] want Help in generating random images
Ok here I am attaching one example ... good point to start but still needs lots of improvement.. (Lots of random variable declared, unncessary inner class) :D
Btw, if u improve it plz attach improved code... :bigyello: