Save WPF image with Shader effects applied? 
Posted: 28 July 2011 01:50 AM   [ Ignore ]
Rank
Joined  2010-03-30
Total Posts:  63
New Member

I have a WPF Image control with attached blur effect. Is there a way to save the image (with blur) ?

Thank you.

UPDATE: I’m using now new custom effect which derives from System.Windows.Media.Effects.ShaderEffect. I would like to save my image with shader effect applied.

(.net Framework 4.0)

ShaderEffect se = new ColorToneShaderEffect();
            
Grid r = new Grid();
            
r.Background = new ImageBrush(imageShow.Source);
            
r.Effect se;

            
Size sz = new Size(imageShow.Source.WidthimageShow.Source.Height);
            
r.Measure(sz);
            
r.Arrange(new Rect(sz));

            
RenderTargetBitmap rtb = new RenderTargetBitmap((int)imageShow.Source.Width, (int)imageShow.Source.Height96d96dPixelFormats.Default);
            
rtb.Render(r);

            
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
            
encoder.Frames.Add(BitmapFrame.Create(rtb));

            
FileStream fs File.Open("iamge.jpg"FileMode.Create);
            
encoder.Save(fs);
            
fs.Close();

but, It saved also the original image.

 Signature 

http://www.amusegroup.com

Profile
 
 
Posted: 29 July 2011 09:37 PM   [ Ignore ]   [ # 1 ]
Rank
Joined  2010-03-30
Total Posts:  63
New Member

e.............

 Signature 

http://www.amusegroup.com

Profile
 
 
Posted: 23 December 2013 09:56 PM   [ Ignore ]   [ # 2 ]
Rank
Joined  2013-12-02
Total Posts:  20
New Member

Maybe you can try this image saving control within .net windows forms application which can be used to save current programming image in the forms of image and document, including WPF. I usually take this image saving component of an third party image reading toolkit to save image in Bitmap form.

Profile