I was wondering if there\'s a way in order to remove the padding generated by the 24 bit Bitmap for each scan line.
What I mean is like this :
Original [Pure
No, you'll have to remove it yourself. Padding is added to ensure that the start of a scanline in the bitmap starts at a multiple of 4. So getting padding is pretty likely when the pixel format is 24bpp, bmp_bitmap.Width * 3 is only divisible by 4 by accident.
You'll need a loop to copy each line. Something like this:
byte[] bytes = new byte[bmpData.Width * bmpData.Height * 3];
for (int y = 0; y < bmpData.Height; ++y) {
IntPtr mem = (IntPtr)((long)bmpData.Scan0 + y * bmpData.Stride);
Marshal.Copy(mem, bytes, y * bmpData.Width * 3, bmpData.Width * 3);
}