Assembly Reference problem while Saving Images
Last post 05-11-2008 10:42 PM by Allen Chen – MSFT. 1 replies.
Sort Posts:
05-08-2008 8:03 AM
Assembly Reference problem while Saving Images

 Hi All,

I am developing an application using Silverlight Ink.

I have completed writing and erasing and working fine.

Now I have to add a functionality to save the content to an image entered by user when he clicks a save button.

I am unable to get that done. I have used this code and not working for me.

RenderTargetBitmap target = new RenderTargetBitmap((int)inkCtrl.ActualWidth, (int)inkCtrl.ActualHeight, 96d, 96d, PixelFormats.Default);
            target.Render(inkCtrl);
            PngBitmapEncoder encoder = new PngBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(target));
            FileStream fs = File.Open(@"c:\stuff\InkWithEffects.png", FileMode.OpenOrCreate);
            encoder.Save(fs);
            fs.Close();

When I try to build the app, it is throwing an error says

The type or namespace name 'PngBitmapEncoder' could not be found (are you missing a using directive or an assembly reference?)

I have added library System.Windows.Media.Imaging; But no use.

Please save me.

Thanks in Advance.

 

 

DreamZone.WinIT

Joined on 04-11-2008
Posts 1
05-11-2008 10:42 PM
Marked as Answer
Re: Assembly Reference problem while Saving Images

Hi:

  PngBitmapEncoder  is not supported currently. Also we could only store files in isolated storage for the security reason.

http://silverlight.net/Quickstarts/Other/StoreData.aspx

  You may refer to this article:

http://www.thedatafarm.com/blog/2008/01/31/ConvertingSilverlightInkPresenterImagesToAPNGFile.aspx

Regards

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Allen Chen – MSFT

Joined on 03-16-2007
Posts 717