Bitmap Image
-
Hi, All I want to make a bitmap thats Each pixel has different Color. I defined it size 1024,700 and used three nested Loops 0 to 255 to get unique color and setpixel sets this color to pixel. but my bmp file's pixel still contains duplicate colors,can anyone will guide me. Thanks again, bye
int x=0,y=0; int tot = 0; Bitmap Bmp; //Color color=new System.Drawing.Color.; Bmp = new Bitmap(1024, 700,PixelFormat.Format32bppPArgb); int h = 0; for (int i = 0; i <256; i = i + 8) { for (int j = 0; j < 256; j = j += 1) { for (int k = 0; k < 256; k += 1, x++, h++) { if (h > 255) h = 0; Color newColor = Color.FromArgb(255,i, j, k); Bmp.SetPixel(x, y, newColor); if (x == 1023) { x = 0; y++; } if (y >= 699) { try { Bmp.Save("bmp1.bmp", ImageFormat.Png); } catch (Exception ex) { Response.Write(ex.Message); } return; } } }
Bajrang Singh Using .net 2.0 (VS2005)