writing text on image asp.net (without affecting size)
<p>I have created a handler for writing text on Image which call a function written below</p>

<pre><code>private bool HavException { get; set; }
private string ExceptionMessage { get; set; }
public Bitmap SourceImage { get; set; }
public Bitmap DestinationImage { get; set; }
public ImageMethods()
{
    HavException = false;
    ExceptionMessage = string.Empty;
}
public Image AddWatermarkText(Image img, string textOnImage)
{
    try
    {
        textOnImage = ConfigurationManager.AppSettings["textOnImage"];
        var opacity = Int32.Parse(ConfigurationManager.AppSettings["opicity"]);
        var red = Int32.Parse(ConfigurationManager.AppSettings["red"]);
        var green = Int32.Parse(ConfigurationManager.AppSettings["green"]);
        var blue = Int32.Parse(ConfigurationManager.AppSettings["blue"]);
        var fontSize = Int32.Parse(ConfigurationManager.AppSettings["fontSize"]);
        var fontName = ConfigurationManager.AppSettings["fontName"];

        var lobFromImage = Graphics.FromImage(img);
        var lobFont = new Font(fontName, fontSize, FontStyle.Bold);
        var lintTextHw = lobFromImage.MeasureString(textOnImage, lobFont);
        var lintTextOnImageWidth = (int)lintTextHw.Width;
        var lintTextOnImageHeight = (int)lintTextHw.Height;
        var lobSolidBrush = new SolidBrush(Color.FromArgb(opacity, Color.FromArgb(red, green, blue)));
        // lobFromImage.Clear(Color.White);
        lobFromImage.DrawImage(img, img.Height, img.Width);

        var posLeft = (img.Width - lintTextOnImageWidth) / 2;
        posLeft = posLeft &gt; 0 ? posLeft : 5;
        var lobPoint = new Point(posLeft, (img.Height / 2) - (lintTextOnImageHeight / 2));
        //  var lobPoint = new Point(RandomNumber(0, img.Width - lintTextOnImageWidth), RandomNumber(0, img.Height - lintTextOnImageHeight));
        lobFromImage.DrawString(textOnImage, lobFont, lobSolidBrush, lobPoint);

        lobFromImage.Save();
        lobFromImage.Dispose();
        lobSolidBrush.Dispose();
        lobFont.Dispose();
    }
    catch (Exception ex)
    {
        HavException = true;
        ExceptionMessage = ex.Message;
    }
    return img;
}
</code></pre>

<p>Every thing is working fine but the size of image is getting increased by 2 to three times.
Is there any way that the size does not increase too much. I have jpg as original image.</p>

<p>Thanks </p>
