title: GDI Antialiasing not working well on Server 2008
body: <p>I'm using System.Drawing to generate some images on the fly that include a base image plus some stretched / scaled text. Everything is nice and neat on my LOCALHOST environment, but when I publish to my server (Server 2008), I lose some of the antialiasing and the image quality gets grainy.</p>
  
  <p>Here is an example copied from my local environment (Windows 7), and then from my server (Server 2008)</p>
  
  <p>Windows 7:</p>
  
  <p><img src="https://i.stack.imgur.com/CEUbP.png" alt="enter image description here"></p>
  
  <p>Windows 2008:</p>
  
  <p><img src="https://i.stack.imgur.com/w7txe.png" alt="enter image description here"></p>
  
  <p>As you can see, the images are the same size, and the fonts are scaled the same as well. The Server version doesn't seem to have anti-aliasing to smooth out the edges. Here's the main piece of code: imgSign and grSign are an established Image and Graphics object with a set size / background color onto which the text is to be scaled / drawn.</p>
  
  <pre><code>'Requested size of test
  Dim textSize As SizeF = grSign.MeasureString(textString, font)
  Dim intTextWidth As Integer = textSize.Width
  Dim intTextHeight As Integer = textSize.Height
  
  'Create image to hold text
  Dim img As Drawing.Image = New Bitmap(intTextWidth, intTextHeight)
  Dim gr As Graphics = Graphics.FromImage(img)
  
  'Smoothing mode
  gr.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  gr.TextRenderingHint = Text.TextRenderingHint.AntiAlias
  
  'Scale Text
  Dim sngScaleWidth As Single = imgSign.Width / intTextWidth
  If sngScaleWidth &gt; 1 Then sngScaleWidth = 1 'Don't scale down width if it doesn't need to be
  Dim sngScaleHeight As Single = imgSign.Height / intTextHeight
  grSign.ScaleTransform(sngScaleWidth, sngScaleHeight)
  
  'Draw text
  gr.DrawString(textString, font, Brushes.White, 0, 0)
  </code></pre>
  
  <p>Is there some functionality that isn't there on Server 2008 that I have to work around, or a switch I can set to increase the quality, or do I need to look elsewhere?</p>