Text size problem while writing in an image
-
Hi, When a user uploads an image in my image mangement module writen in asp.net and csharp , i need to resize , write some text on top of it and save This is working fine for all sizes of images but for large images i had to increase the font size used in code The below code is working for small images(around 500x600) g.DrawString("test", new System.Drawing.Font("verdana", 14, System.Drawing.FontStyle.Bold),System.Drawing.Brushes.Black, ((thumbNailImg.Width / 2)-5), (thumbNailImg.Height - 20)); But for large images g.DrawString("test", new System.Drawing.Font("verdana", 35, System.Drawing.FontStyle.Bold),System.Drawing.Brushes.Black, ((thumbNailImg.Width / 2)-5), (thumbNailImg.Height - 20)); i need to change the font size to a larger value, otherwise it wont be readable in the image Here is what i am doing 1) Resizing image uploaded to 250x200 2) Adding some text over re-sized image 3) Saving it images sized around 500x600 text is readble but large images i need to change font size I want to make font size fixed and write text on top of that with text in the image readable any idea how to do this complete code listing is shown below String UploadedFile = MyFile.PostedFile.FileName; int ExtractPos = UploadedFile.LastIndexOf("\\") + 1; //to retrieve only Filename from the complete path String UploadedFileName = UploadedFile.Substring(ExtractPos,UploadedFile.Length - ExtractPos); // Display information about posted file. Div is invisible by default FileName.InnerHtml =UploadedFileName; MyContentType.InnerHtml = MyFile.PostedFile.ContentType; ContentLength.InnerHtml = MyFile.PostedFile.ContentLength.ToString(); FileDetails.Visible = true; //div is made visible // Save uploaded file to server at the in the Pics folder MyFile.PostedFile.SaveAs(Request.PhysicalApplicationPath + "images\\" + UploadedFileName ); //thumbnail creation starts //Read in the image filename whose thumbnail has to be created String imageUrl = UploadedFileName; //Read in the width and height int imageHeight = 200; int imageWidth = 250; //You may even specify a standard thumbnail size //int imageWidth = 70; //int imageHeight = 70; if (imageUrl.IndexOf("/") >= 0 || imageUrl.IndexOf("\\") >= 0) { //We found a / or \ Response.End();