title: rotating an image modifies the resolution and clarity
body: <p>Consider the code below to rotate an image.</p>
  
  <p>The problem is the resolution of the image is getting low and the image is getting unclear.</p>
  
  <p>How can I avoid this problem?</p>
  
  <pre><code>private Bitmap rotateImage(Bitmap b, float angle)
  {
      //create a new empty bitmap to hold rotated image
      Bitmap returnBitmap = new Bitmap(b.Width, b.Height);
      //make a graphics object from the empty bitmap
      Graphics g = Graphics.FromImage(returnBitmap);
      //move rotation point to center of image
      g.TranslateTransform((float)this.Width / 2, (float)this.Height / 2);
      g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
      //rotate
      g.RotateTransform(angle);
      g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
      g.TranslateTransform(-(float)this.Width / 2, -(float)this.Height / 2);
      g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
      //draw passed in image onto graphics object
      g.DrawImage(b, new Point(0, 0));
      g.Dispose();
      return returnBitmap;
  }
  </code></pre>