private void button3_Click(object sender, EventArgs e) //коррекция с опорным цветом //286 124 54 59 { if (!CheckSourceImage()) { return; } Bitmap palitre = new Bitmap(pictureBoxColorPalitre.Image); Color destinationColor, sourceColor; int coordinateX = 0, coordinateY = 0; if (labelRGBcolorPalitre.Text != "-" && labelCoordinatesPixel.Text != "-") { var strSrc = labelCoordinatesPixel.Text.Split(' '); var strDst = labelRGBcolorPalitre.Text.Split(' '); sourceColor = editImage.GetPixel(int.Parse(strSrc[0]), int.Parse(strSrc[1])); destinationColor = palitre.GetPixel(int.Parse(strDst[0]), int.Parse(strDst[1])); } else { try { destinationColor = StringColor[textBoxSupportingColor.Text.ToLower()]; } catch { MessageBox.Show("Реализованы не все цвета :)"); return; } var str = textBoxCoordinatesPixel.Text.Split(' ', ','); if (str.Length != 2) { MessageBox.Show("Неверно введены координаты"); return; } coordinateX = int.Parse(str[0]); coordinateY = int.Parse(str[1]); sourceColor = editImage.GetPixel(coordinateX, coordinateY); } if (coordinateX >= sourceImage.Width || coordinateY >= sourceImage.Height) { MessageBox.Show("Вне границ изображения"); return; } editImage = LuminanceConversions.GetCorrectionImageBasedColor(editImage, destinationColor, sourceColor); pictureBoxImage.Image = editImage; editImage.Save(@"CorrectionBasedOnColor.jpg"); label5TypeImage.Text = "Коррекция с опорным цветом"; }