I´m trying to send a bitmap over a tcp/ip connection. So far my programm works as it should. But during debugging I discovered a strange value of my bitmap byte[].
I open a 24bit bitmap and convert it to 16bit. The bitmap is 800x600 so the byte[] length should be 800*800*2Byte = 960000Byte... But my array is 960054...
Where do the extra Bytes come from??
Console.WriteLine("Bitmap auf 16Bit anpassen...\n");
Rectangle r = new Rectangle(0,0,bitmap_o.Width, bitmap_o.Height);
Bitmap bitmap_n = bitmap_o.Clone(r, PixelFormat.Format16bppRgb555);
bitmap_n.Save("test2.bmp");
Console.WriteLine("Neue Bitmap-Eigenschaften:");
Console.WriteLine(bitmap_n.Width.ToString());
Console.WriteLine(bitmap_n.Height.ToString());
Console.WriteLine(bitmap_n.PixelFormat.ToString());
byte[] data = new byte[0];
MemoryStream mem_stream = new MemoryStream();
bitmap_n.Save(mem_stream, ImageFormat.Bmp);
data = mem_stream.ToArray();
mem_stream.Close();
Console.WriteLine(data.Length.ToString());
stream.Write(data, 0, 960000);
Console.WriteLine("Sending data...");