Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Bitmap Monochromatic(Bitmap sourceImage)
- {
- var result = new Bitmap(sourceImage.Width,sourceImage.Height);
- for (var i = 0; i < sourceImage.Height - 1; i++)
- for (var j = 0; j < sourceImage.Width - 1; j++)
- {
- var pixel = sourceImage.GetPixel(j, i);
- var colorValue = (int)(0.3 * pixel.R + 0.6 * pixel.G + 0.1 * pixel.B);
- var newColor = Color.FromArgb(colorValue, colorValue, colorValue);
- result.SetPixel(j,i,newColor);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement