I writing a code to color my bitmap image pixels for
int[,] unClusteredImage = new int[367,158];
Bitmap clusteredImage = new Bitmap(367, 158);
for (int row = 0; row < unClusteredImage.GetLength(0); row++)
for (int col = 0; col < unClusteredImage.GetLength(1); col++)
if (unClusteredImage[row, col] == 0)
clusteredImage.SetPixel(row, col, Color.Red);
else if (unClusteredImage[row, col] == 1)
clusteredImage.SetPixel(row, col, Color.Blue);
else if (unClusteredImage[row, col] == 2)
clusteredImage.SetPixel(row, col, Color.Green);
else if (unClusteredImage[row, col] == 3)
clusteredImage.SetPixel(row, col, Color.Yellow);
else if (unClusteredImage[row, col] == 4)
clusteredImage.SetPixel(row, col, Color.Black);
else if (unClusteredImage[row, col] == 5)
clusteredImage.SetPixel(row, col, Color.Orange);
else if (unClusteredImage[row, col] == 6)
clusteredImage.SetPixel(row, col, Color.Lime);
else if (unClusteredImage[row, col] == 7)
clusteredImage.SetPixel(row, col, Color.Purple);
clusteredImage.Save("test.jpeg");
The problem is that when i save the bitmap using the bitmap.save method I lose some pixels when I open it in paint I noticed that some pixels are not there in the bottom of my image