Инвертировать цветное изображение в MVC C#
invert color image in MVC C#
Что я уже пробовал:
[HttpPost] public JsonResult InvertColorMatrix(Image imgSource, string directoryPath) { string imageFullPath = String.Empty; int currentOffSet = 0, imageLength = 0; //DataCorrectionViewModel listDCViewModel = (DataCorrectionViewModel)TempData.Peek("ListDCViewModel"); DataCorrectionViewModel listDCViewModel = (DataCorrectionViewModel)TempData.Peek("ListDCViewModel"); DCImageViewModel imageViewModel = listDCViewModel.Item.ImageData; //directoryPath = @"C:\RL520DAT\Images"; directoryPath = string.IsNullOrEmpty(directoryPath) ? "C:\\RL520DAT\\Images" : directoryPath; imageFullPath = directoryPath + "\\" + imageViewModel.Image_Path.ToString() + ".FIM"; imageLength = Convert.ToInt32(imageViewModel.Cap_Front_Image_Size); currentOffSet = Convert.ToInt32(imageViewModel.Image_Offset); //Bitmap bmpDest = new Bitmap(imgSource.Width, imgSource.Height); Bitmap bmpDest = new Bitmap(imgSource.Width, imgSource.Height); ColorMatrix clrMatrix = new ColorMatrix(new float[][] { new float[] { -1, 0, 0, 0, 0 }, new float[] { 0, -1, 0, 0, 0 }, new float[] { 0, 0, -1, 0, 0 }, new float[] { 0, 0, 0, 1, 0 }, new float[] { 1, 1, 1, 0, 1 } }); using (ImageAttributes attrImage = new ImageAttributes()) { attrImage.SetColorMatrix(clrMatrix); using (Graphics g = Graphics.FromImage(bmpDest)) { g.DrawImage(imgSource, new Rectangle(0, 0, imgSource.Width, imgSource.Height), 0, 0, imgSource.Width, imgSource.Height, GraphicsUnit.Pixel, attrImage); } } //return bmpDest; return Json(bmpDest, JsonRequestBehavior.AllowGet); }
F-ES Sitecore
А что у тебя за вопрос?