hi im doing an app which is write text or draw something on the image, can you help me how can i write the code im trying many ways but im not getting the correct code i need dynamically write something on image...
pls any one can help me....
Loading

Abhijit PatilRank #700 · 3.4K reputationPosted Mar 7, 2014, 12:43 AM EST
hey ramya,
There are basically 6 steps for my sample:
Ramya P52 reputationPosted Mar 7, 2014, 1:59 AM EST
otherwise can you send a sample app for it...
Ramya P52 reputationPosted Mar 7, 2014, 2:21 AM EST
Abhijit PatilRank #700 · 3.4K reputationPosted Mar 7, 2014, 2:25 AM EST
try this code
//This is the image where we are going to write the text on it. string stringMasterImageName = @"D:\MasterImage.jpg"; Bitmap bitmapMasterImage = new System.Drawing.Bitmap(stringMasterImageName); Graphics graphicsMasterImage = Graphics.FromImage(bitmapMasterImage); //Set the alignment based on the coordinates StringFormat stringformatWriteTextFormat = new StringFormat(); stringformatWriteTextFormat.Alignment = StringAlignment.Center; //Set the font color Color colorStringColor = System.Drawing.ColorTranslator.FromHtml("#000081"); string stringText = "Text Content Here"; graphicsMasterImage.DrawString(stringText, new Font("Tahoma", 30, FontStyle.Italic), new SolidBrush(colorStringColor), new Point(310, 260), stringformatWriteTextFormat); Response.ContentType="image/jpeg"; bitmapMasterImage.Save(Response.OutputStream, ImageFormat.Jpeg); //Save the new image in a physical location string stringOutPutFileName = @"D:\\OutPut.jpg"; bitmapMasterImage.Save(stringOutPutFileName); hope it helps. any query inform me.Ramya P52 reputationPosted Mar 7, 2014, 2:34 AM EST
Abhijit PatilRank #700 · 3.4K reputationPosted Mar 7, 2014, 2:36 AM EST
can you post error here then i tell u what is problem in your co
Ramya P52 reputationPosted Mar 7, 2014, 2:42 AM EST
can you pls check my app and how to write the code for writing text on image..
thank you...
Selva GanapathyRank #560 · 4.3K reputationPosted Mar 11, 2014, 8:25 PM EDT
It seems you are trying to have a text into an image. if you need to do like this please use the following code snippet to achieve the same
var xValue = "Tamil valga! Tamil Valarga!!"+ Cursor.Position.X .ToString(); // Get the Value of text
var taskIcon = new Bitmap(100, 100); // Get a bitmap
var font = new Font("TimesNewRoman", 27, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel); // Get a font
var graphics = Graphics.FromImage(taskIcon); // Get a graphics with the bitmap image
graphics.DrawString(xValue, font, Brushes.Red, new PointF(0, 0)); // Add the text value in the graphics
graphics.SmoothingMode = SmoothingMode.AntiAlias; // Smoothing the pixel
graphics.TextRenderingHint = TextRenderingHint.AntiAlias; // Smoothing the text rendering because stem width may differ
The similar this I have used in one of my article which is as follows.
[Blog Link]
http://www.c-sharpcorner.com/Blogs/13621/getting-cursor-position-and-showing-it-in-taskbar-without-oc.aspx
Regards,
Selva Ganapathy K
Gage Brody2 reputationPosted May 12, 2014, 10:56 PM EDT
If you mean by that you want to give the user the ability to specify the location of text before drawing it, you can do this using Annotations objects.
The user can load the image, add the text annotation object on it, change its location and then draw (burn) the text object on the image, so that the text becomes part of image's pixel data.
We used in one of our internal-use application a similar feature from a commercial toolkit- leadtools.
If you are interested, you can find more information on their website.