Exporting as .bmp

5 posts, 0 answers
  1. Jens
    Jens avatar
    27 posts
    Member since:
    Mar 2009

    Posted 18 Nov 2009 Link to this post


    We are using the export utilities to save a framework element as an image, using the following procedure:

    Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage( element, output, new Telerik.Windows.Media.Imaging.BmpBitmapEncoder() ); 

    When exporting to .bmp files, the file is sometimes corrupted or its contents are misaligned. This problem only seems to occur when exporting to .bmp (the other formats seem to work fine).

    I could reproduce the same problem using your charting demo when resizing the browser window in a way that not all contents of the chart are visible. I have attached a file showing the misalignment. (I converted the .bmp to a .png, as bitmaps cannot be uploaded.)

    Do you have any ideas how to solve this problem?

  2. Andrey
    Andrey avatar
    1681 posts

    Posted 20 Nov 2009 Link to this post

    Hi Jens,

    Thank you for the sample that shows the misalignment in the exported BMP image.
    We've reproduced the problem.
    We will update the exporting to BMP image in the nearest internal build.

    Andrey Murzov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. LaDonna
    LaDonna  avatar
    8 posts
    Member since:
    Jul 2010

    Posted 02 Jan 2015 in reply to Andrey Link to this post

    We are using version v4.0.30319 and having this same issue exporting the image into a BMP file.  We've had the same code in place for years, and periodically upgrade to newer versions of Telerik, and we just noticed that this functionality has stopped working for us.  Is there another fix that is needed for BMP exports?

    Thank you!
  4. LaDonna
    LaDonna  avatar
    8 posts
    Member since:
    Jul 2010

    Posted 02 Jan 2015 Link to this post

    I meant to write that we have this same issue using PNG files, and not BMP, but the same issue.  Thanks again for your help!
  5. LaDonna
    LaDonna  avatar
    8 posts
    Member since:
    Jul 2010

    Posted 05 Jan 2015 Link to this post

    Was helped through support ticket and told to change code as follows:

    The default Template of RadMap has changed during the last years and I guess the first ItemsPresenter is not the one you need. You can try the following code:
    Copy codepublic void saveImage(Stream stream){    var presenters = this.radMap.ChildrenOfType<ItemsPresenter>().ToList();    if (presenters != null && presenters.Count > 1)    {        FrameworkElement element = presenters[1];        Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(element, stream, new Telerik.Windows.Media.Imaging.PngBitmapEncoder());    }}

    This solved my issue!  Thanks!
Back to Top