Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7924921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:01:21+00:00 2026-06-03T18:01:21+00:00

I use Graphics.DrawString Method to write a text on image, but the text quality

  • 0

I use Graphics.DrawString Method to write a text on image,
but the text quality become too low after saving image.
this id my code:

Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("~/k32.jpg"));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
graphicImage.DrawString("string", font, s, new Point(10, 10));
graphicImage.InterpolationMode =   System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
        graphicImage.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
        graphicImage.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
        graphicImage.TextContrast = 0;
Response.ContentType = "image/jpeg";
bitMapImage.Save(Server.MapPath("~/k33.jpg"), ImageFormat.Jpeg);

How can I improve the text quality?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:01:28+00:00Added an answer on June 3, 2026 at 6:01 pm

    You can try using a lossless image format:

    bitMapImage.Save(Server.MapPath("~/k33.png"), ImageFormat.Png);
    

    Or if you really want to stick with jpeg then you can try adjusting the JPEG compression level by referring to this MSDN How to: Set JPEG Compression Level

    private void VaryQualityLevel()
    {
        // Get a bitmap.
        Bitmap bmp1 = new Bitmap(@"c:\TestPhoto.jpg");
        ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);
    
        // Create an Encoder object based on the GUID
        // for the Quality parameter category.
        System.Drawing.Imaging.Encoder myEncoder =
            System.Drawing.Imaging.Encoder.Quality;
    
        // Create an EncoderParameters object.
        // An EncoderParameters object has an array of EncoderParameter
        // objects. In this case, there is only one
        // EncoderParameter object in the array.
        EncoderParameters myEncoderParameters = new EncoderParameters(1);
    
        EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 100L);
        myEncoderParameters.Param[0] = myEncoderParameter;
        bmp1.Save(Server.MapPath("~/k33.jpg"), jgpEncoder, myEncoderParameters);
    }
    
    
    private ImageCodecInfo GetEncoder(ImageFormat format)
    {
    
        ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
    
        foreach (ImageCodecInfo codec in codecs)
        {
            if (codec.FormatID == format.Guid)
            {
                return codec;
            }
        }
        return null;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use DrawString to write text as an image and then
I use this code for drawing text in a panel: Graphics g = panel1.CreateGraphics();
use this website a lot but first time posting. My program creates a number
If I use TextRenderer.DrawText() using the Graphics object provided in the OnPaintBackground my text
This is the output i get when i use DrawString. I=Smith,John II=Johnson,Mark III=Anderson,James IV=William,Craig
I am trying to use the graphics object to load an image in and
In winforms app I use Graphics.DrawString(String, Font, Brush, RectangleF, StringFormat) with StringTrimming.EllipsisWord for the
What I am trying to do is use the DrawString() method to draw a
I'm currently debugging a method we use to tag images with a certain text
I'm using the .NETCF (Windows Mobile) Graphics class and the DrawString() method to render

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.