Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- redC = Int32.Parse(red.Text);
- greenC = Int32.Parse(green.Text);
- blueC = Int32.Parse(blue.Text);
- Bitmap bitmap = new Bitmap(image);
- //edit image
- List<int> list = new List<int>() { redC, greenC, blueC };
- Random rnd = new Random();
- Color color = new Color();
- Color color2 = new Color();
- color = Color.FromArgb(255, redC, greenC, blueC);
- for (int x = 0; x < bitmap.Width; x++) {
- for (int y = 0; y < bitmap.Height; y++) {
- if (bitmap.GetPixel(x, y) == color) {
- List<int> list2 = list;
- int max = list2.IndexOf(list2.Max());
- Console.WriteLine(list2.Max());
- Console.WriteLine(max);
- list2[max] += rnd.Next(-20, 20);
- if (list2[max] > 255) {
- list2[max] = 255;
- } else if (list2[max] < 0) {
- list2[max] = 0;
- }
- color2 = Color.FromArgb(255, list2[0], list2[1], list2[2]);
- bitmap.SetPixel(x, y, color2);
- }
- }
- }
- pictureBox1.Image = bitmap;
Advertisement
Add Comment
Please, Sign In to add comment