I have an image in WriteableBitmap format now I want to apply a sketch filter on it and show it in an image control without saving. how can I achieve this ?
The Lumia Imaging SDK has a SketchFilter you can use.
Here's a quick function which will apply a SketchFilter to wbIn and return the filtered image in wbOut
using Lumia.Imaging;
using Lumia.InteropServices.WindowsRuntime;
using Lumia.Imaging.Artistic;
...
async Task FilterWriteableBitmap(WriteableBitmap wbIn, WriteableBitmap wbOut)
{
using (var imageSource = new BitmapImageSource(wbIn.AsBitmap()))
using (var filterEffect = new FilterEffect(imageSource))
using (var renderer = new WriteableBitmapRenderer(filterEffect,wbOut))
{
var filter = new SketchFilter(SketchMode.Color);
filterEffect.Filters = new IFilter[] { filter };
await renderer.RenderAsync();
}
}
...
await FilterWriteableBitmap(originalWB,filteredWB)
img.Source = filteredWB;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.