Byte[] bPalette = new Byte[2014];
for (int k = 0; k < 256; k++)
{
bPalette[k * 4 + 0] = sortedColorList[k].B;
bPalette[k * 4 + 1] = sortedColorList[k].G;
bPalette[k * 4 + 2] = sortedColorList[k].R;
bPalette[k * 4 + 3] = 0;
}
Bitmap paletteBMP=new Bitmap(256,50);
for (int i = 0; i < 256; i++)
{
Color newColor = new Color();
int nb = (int)bPalette[4*i];
int ng = (int)bPalette[4*i + 1];
int nr = (int)bPalette[4*i + 2];
newColor = Color.FromArgb(nr, ng, nb);
for(int j = 0; j < 50; j++)
{
paletteBMP.SetPixel(i, j, newColor);
}
}
Image im = paletteBMP;