This is a migrated thread and some comments may be shown as answers.

ExportToImage huge memory usage

2 Answers 66 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Claudio
Top achievements
Rank 1
Claudio asked on 23 Aug 2011, 08:35 AM
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 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 29 Aug 2011, 09:51 AM
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 >>

0
Claudio
Top achievements
Rank 1
answered on 29 Aug 2011, 04:53 PM
Thank you Evgenia, I supposed this, I'll try with visiting the visual tree and convert the objects in SVG... 
Tags
General Discussions
Asked by
Claudio
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Claudio
Top achievements
Rank 1
Share this question
or