Text quality/clarity RRS feed

  • Question

  • User939919354 posted
    What do any of you guys do to try and make graphics that have text written to them show up crisp and clear? I've tried a variety of things, and still cannot seem to get the text to look decent. Here's a basic example: <%@ Import Namespace="System.Drawing"%> <%@ Import Namespace="System.Drawing.Imaging"%> <%@ Import Namespace="System.Drawing.Drawing2D"%> <% Dim strTest As String="Testing Testing" Dim objStyle As System.Drawing.FontStyle=3 Dim objFont As New Font("Arial", 14, objStyle) Dim objBrush As New SolidBrush(Color.White) Dim objPoints As New PointF(20F, 13F) Dim objBitmap As New Bitmap(200, 50) Dim objGraphics as Graphics=Graphics.FromImage(objBitmap) objGraphics.Clear(Color.FromArgb(219, 178, 178)) objGraphics.InterpolationMode=InterpolationMode.HighQualityBicubic objGraphics.SmoothingMode=SmoothingMode.AntiAlias objGraphics.CompositingQuality=CompositingQuality.HighQuality objGraphics.DrawString(strTest, objFont, objBrush, objPoints) objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg) objBitmap.Dispose() : objGraphics.Dispose() %>
    Thursday, March 25, 2004 11:25 AM

All replies

  • User-1372641848 posted
    1) Try changing Jpeg compression to improve quality.. http://www.vbaccelerator.com/home/VB/Code/vbMedia/Using_GDI_Plus/Reading_and_Writing_JPG__PNG__TIF_and_GIF_Files/article.asp 2) Try with gif image using 256 color pallet(choose color with value 51,102,153,204,255) and no antialias I am not sure how this two things will affect .... any comments from any body? objGraphics.InterpolationMode=InterpolationMode.HighQualityBicubic objGraphics.CompositingQuality=CompositingQuality.HighQuality
    Thursday, March 25, 2004 1:46 PM
  • User-865881720 posted
    Heres the one that I was missing until I finally found it in the System.Drawing.Text namespace: objBitmap.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias Added to the SmoothingMode which you've already set, this makes a world of difference in text rendering! For a sample, check this out on my current project: www.westernmainearts.org/randomartwork.aspx Note to Moderator: I just joined the forum today and didn't check first to see if I can post website links as samples. If I'm not supposed to, please delete the reference.
    Friday, March 26, 2004 9:22 PM
  • User939919354 posted
    Thank you for the helpful tip!!
    Monday, March 29, 2004 5:00 PM