//https://stackoverflow.com/questions/186062/can-an-asp-net-mvc-controller-return-an-image public byte[] GetImage() { // string fn = @"C:\Users\risto.ikonen\Pictures\Screenshots\s.png"; var fn = Path.Combine(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.Parent.FullName, @"s.png"); BuGeRedLister bl = new BuGeRedLister(); System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(fn); var buglist = bl.GetBuGeRedListFromBitmap(bmp); Action <BuGeRed> redifi = _ => { _.Red = 250; }; buglist.ForEach(redifi); var bmpedited = bl.GetBitmapFromBuGeRedList(buglist, bmp.Width, bmp.Height); using (var stream = new MemoryStream()) { bmpedited.Save(stream, System.Drawing.Imaging.ImageFormat.Png); return(stream.ToArray()); } //return (FileResult)((Image) bmp); }
public Image GetImage2() { var fn = Path.Combine(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.Parent.FullName, @"s.png"); BuGeRedLister bl = new BuGeRedLister(); System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(fn); return(bmp); }