I would like to return an image from a controller and be able to apply my own filters on it.
I created a controller and would like it to return Content(Img.BinaryData,"image/jpeg");
A view is not needed.
I'm using DynamicImage plugin to get a remote image and do some filters on it, but it returns a System.Windows.Media.Imaging.WriteableBitmap
object.
Here is the furthest I got, but I'm trying to return it as binary data:
using SoundInTheory.DynamicImage.Sources;
var composition = new Composition();
ImageLayer layer = new ImageLayer { Source = new RemoteImageSource { Url = "http://www.google.com/images/srpr/logo4w.png" } };
composition.Layers.Add(layer);
GeneratedImage generatedImage = composition.GenerateImage();
var Img = generatedImage.Image; // returns System.Windows.Media.Imaging.WriteableBitmap
return Content(Img.ToString(),"image/jpeg");
What am I missing here?