I am attempting to do some image processing operations....what I want to do is take in a bitmap and replace the square pixel with a round dot pixel....I can iterate the bitmap and get the pixel color, brightness and replace them with another color...but would like to know how to change the shape of the pixel....
this is what I have so far:
Any help would be appreciated
-InkedGFX
this is what I have so far:
Bitmap testImg = (Bitmap)Image.FromFile(AppDomain.CurrentDomain.BaseDirectory +[URL="file://\\Assets\\Images\\Seps\\yellow_sep.png"]\\Assets\\Images\\Seps\\yellow_sep.png[/URL]); Bitmap result = new Bitmap(testImg.Width , testImg.Height); Graphics g = Graphics.FromImage(result); for (int i = 0; i < testImg.Width; i++) { for (int y = 0; y < testImg.Height; y++) { Color c = testImg.GetPixel(i, y); var brightness = Brightness(c); if (c == Color.FromArgb((int)brightness, (int)brightness, (int)brightness, (int)brightness)) { Pen dot = new Pen(Color.FromArgb((int)brightness, 0,0,0), 1F); result.SetPixel(i, y, dot.Color); g = pictureBox2.CreateGraphics(); g.DrawEllipse(dot, i, y, 4, 4); } else { Pen dot = new Pen(Color.FromArgb((int)brightness, 255,255,255), 1F); result.SetPixel(i, y, dot.Color); g = pictureBox2.CreateGraphics(); g.DrawEllipse(dot, i, y, 4, 4); } } } private float Brightness(Color c) { return (float)Math.Sqrt( c.R * c.R * .241 + c.G * c.G * .691 + c.B * c.B * .068); }
Any help would be appreciated
-InkedGFX