How to save FrameworkElement as very large raster image?

Advertisement
I have to save my FrameworkElement as
very large raster image. For now I use the RenderTargetBitmapclass
and a BitmapEncoder,
in this way:
RenderTargetBitmap bmp = new RenderTargetBitmap(ElementWidth, ElementHeight,
     90, 96, PixelFormats.Default);
bmp.Render(MyElement);  // OutOfMemoryException here
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bmp));
using (var stream = File.Create(filePath))
{ encoder.Save(stream); }
Where ElementWidth and ElementHeight are large numbers (about 10000x6000). But with this solution there's a OutOfMemoryException when i try to Render my
element.
There are other ways to do what I need (without causing an OutOfMemoryException)? Thanks.
Advertisement

Replay

Following link may help you
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c5e31d70-08d1-4402-8016-0a0b7af49b04/
Gaurav Khanna | Microsoft VB.NET MVP