Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Text size problem while writing in an image

Text size problem while writing in an image

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netgraphicssysadminhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    milpo
    wrote on last edited by
    #1

    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();

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups