ExportToImage huge memory usage

3 posts, 0 answers
  1. Claudio
    Claudio avatar
    13 posts
    Member since:
    Apr 2011

    Posted 23 Aug 2011 Link to this post

    Hi to everybody!
    We are trying to export a Canvas to an image in some formats.
    Actually we reach our goal with this simple code line:

    Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(
                                 MainCanvas,
                                 SetEmptyStream(ms),
                                 new Telerik.Windows.Media.Imaging.PngBitmapEncoder());

    where MainCanvas is a subclass of a Canvas and  the SetEmptyStream function returns an empty stream.
    Everything works but while creating the image, with large canvas, also with few children the Memory usage
    of iexplorer.exe reaches 700/800 MB and IE crashes for OUT OF MEMORY exception.
    The process also takes so much time to complete.
    Maybe it is a normal behavior when working with images... but...
    Anyone knows some workaround to avoid this? the PNG format is not mandatory...

    Thanks to everybody!

  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 29 Aug 2011 Link to this post

    Hi Claudio,

    Unfortunately this is a Silverlight limitation. Working with large images always result "Out Of Memory" exception in Silverlight (exporting of any control with size preservation requires rendering to the WritableBitmap of the same size).

    Regards,
    Evgenia
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. Claudio
    Claudio avatar
    13 posts
    Member since:
    Apr 2011

    Posted 29 Aug 2011 Link to this post

    Thank you Evgenia, I supposed this, I'll try with visiting the visual tree and convert the objects in SVG... 
Back to Top