0

so i have a wpf app, there i have DrawingVisual object, let's call it "visual", also there is RenderTargetBitmap object, let's call it "target". I have some strings of code below.

DrawingVisual visual = new DrawingVisual();
RenderTargetBitmap target = new RenderTargetBitmap(certBg.PixelWidth, certBg.PixelHeight, 96, 96, PixelFormats.Default);
target.Render(visual);
Image img = new Image();
img.Source = target;

How can i save that picture? I thought to use img.Save, but it doesn't work in WPF. I've tried to use BitmapEncoder but it was unsuccsessful. How shall i save on the disk that picture?

4
  • 1
    What is it you want to achieve? The System.Drawing.Bitmap component in WPF has a Save functionality. Try using that instead of the Image control. Commented Aug 18, 2017 at 13:41
  • Eventually stackoverflow.com/questions/4161359/save-bitmapimage-to-file can help you. Commented Aug 18, 2017 at 13:42
  • Does this answer help you? Commented Aug 18, 2017 at 15:38
  • @Lupu "System.Drawing.Bitmap component in WPF" doesn't make sense. System.Drawing.Bitmap is WinForms, not WPF. In WPF you would use a BitmapEncoder. Commented Aug 18, 2017 at 17:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.