Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Remove Alert | Edit | Delete | Change Type


0
Hii,

I have created a small effect using pixel shader and applied it to a image using WPF in c#.Everything works fine but now i am stuck with this final step. How to actually save the image ,after pixel shader effect is applied??

For E.g., I have applied a grayscale effect to a image in image control.Now I want to save it in some format, say jpeg. How to do it? moving further, I want to apply the same effect to a video also. I can manage to apply it but finally how to save that? Please some experts out there help me!!

Again I used WPF in c#... Thank you in advance!!
Posted

You can use following method to do the same for image rendering :-


public BitmapSource GetBitmapSourceFromVisual(FrameworkElement printCanvas)
{
RenderTargetBitmap renderBitmap = null;
try
{
System.Windows.Size size = new System.Windows.Size(printCanvas.Width, printCanvas.Height);

renderBitmap = new RenderTargetBitmap((int)(size.Width), (int)(size.Height), 96, 96, PixelFormats.Default);// PixelFormats.Pbgra32);

renderBitmap.Render(printCanvas);
return renderBitmap;
}
catch (Exception ex)
{
return renderBitmap;
}
}
 
Share this answer
 
Thank you so much sir!! But now the problem is that pixel shaders are not availaible in Windows Store App(Using c#)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900