title: Can Graphics.DrawImage unintentionally trim an image?
body: <p>I'm using code that takes a bitmap and converts it to 24 BPP so that I can use it in a program that specifically requires that file format. Here is the code:</p>
  
  <pre><code>    using (Bitmap tempImage = new Bitmap(pageToScan.FullPath))
      {
         if (tempImage.PixelFormat != System.Drawing.Imaging.PixelFormat.Format24bppRgb)
         {
            using (Bitmap tempImage2 = new Bitmap(tempImage.Size.Width, tempImage.Size.Height,
               System.Drawing.Imaging.PixelFormat.Format24bppRgb))
            {
               using (Graphics g = Graphics.FromImage(tempImage2))
               {
                  g.DrawImage(tempImage, new Point(0, 0));
               }
               RecognizeBitmap(pageToScan, tempImage2); //Thanks to Tim on this refactoring.
            }
         }
         else
            RecognizeBitmap(pageToScan, tempImage);
      }
  </code></pre>
  
  <p>I have two questions about the code above:</p>
  
  <ol>
  <li>With a particular image, I think
  that this clipped the rightmost 200
  pixels right off of tempImage2. Is
  this possible? How might this
  happen, and how can I stop it? A
  friend of mine suggested that it
  might have to do with the stride of
  the TIFF file being used.</li>
  <li>Is there a
  faster way to convert an image to 24
  BPP in memory?</li>
  </ol>