title: C# - Remove Bitmap padding
body: <p>I was wondering if there's a way in order to remove the padding generated by the 24 bit Bitmap for each scan line.</p>
  
  <p>What I mean is like this :</p>
  
  <p>Original [Pure Cyan 24 Bit BMP] :</p>
  
  <pre><code>FF FF 00 FF FF 00 FF FF **00 00** FF FF 00 FF FF 00 FF FF 00
  </code></pre>
  
  <p>Desired output [Removed Padding] :</p>
  
  <pre><code>FF FF 00 FF FF 00 FF FF **00** FF FF 00 FF FF 00 FF FF 00
  </code></pre>
  
  <p><strong>Here's my code for getting the pixel data.</strong></p>
  
  <pre><code>            Bitmap tmp_bitmap = BitmapFromFile;
  
              Rectangle rect = new Rectangle(0, 0, tmp_bitmap.Width, tmp_bitmap.Height);
              System.Drawing.Imaging.BitmapData bmpData =
                  tmp_bitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
                  PixelFormat.Format24bppRgb);
  
              int length = bmpData.Stride * bmpData.Height;
  
              byte[] bytes = new byte[length];
  
              // Copy bitmap to byte[]
              Marshal.Copy(bmpData.Scan0, bytes, 0, length);
              tmp_bitmap.UnlockBits(bmpData);
  </code></pre>
  
  <p>Thank you in advance.</p>