Exported Image is blurred

6 posts, 0 answers
  1. Ciro
    Ciro avatar
    11 posts
    Member since:
    Nov 2013

    Posted 26 Jun 2014 Link to this post

    Hi,

    I have a problem with the "Export to image"  feature of the RadDiagram.
    In particular when I export an image with lots of RadDiagramShape and RadDiagramConnections the image has a  correct dimension, but the shapes and the connections are blurred. 

    The following is the piece of code which I use to  serialize the image and I' ve attached  an example of exported image.

    using (var rawImageStream = new MemoryStream())            {
                    diagram.ExportToImage(rawImageStream, margin: ExportMargin, backgroundBrush: new SolidColorBrush(Colors.White));
                    rawImageStream.Seek(0, SeekOrigin.Begin);

                    using (var trimmedBitmap = new Bitmap(rawImageStream).Trim(0xffffff)) {
                        trimmedBitmap.Save(outputStream, ImageFormat.Png);
                    }
      }


    Is there a way to improve it and render the exported image clearer?
    Thanks

    Ciro
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Jun 2014 Link to this post

    Hi Ciro,

    You can increase the DPI when exporting Image in RadDiagram. The default setting is 96 dpi. You can use an optional parameter in the ExportToImage method:
    public void ExportToImage(Stream stream, BitmapEncoder encoder = null, Rect? enclosingBounds = null, Size returnImageSize = new Size(), Brush backgroundBrush = null, Thickness margin = new Thickness(), double dpi = RadDiagramPrintSettings.DefaultDpi)


    Regards,
    Petar Mladenov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. OlivierDoucy
    OlivierDoucy avatar
    2 posts
    Member since:
    Mar 2009

    Posted 26 Sep 2014 Link to this post

    Hello,

    I have the same problem as Ciro.
    The larger the diagram is, the blurrier it gets. Increasing the dpi does not fix the problem, it only increases the dimensions of the exported image.
    Is there another way to improve it ?

    Thanks
  5. Aakansha
    Aakansha avatar
    20 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 Link to this post

    While using ExportToImage, I dnt want the focused element to come in the image generated. How can I do that?

  6. Ciro
    Ciro avatar
    11 posts
    Member since:
    Nov 2013

    Posted 27 Sep 2014 in reply to Aakansha Link to this post

    I had the same problem of Aakansha. My solution was to memorize the selected shapes, then unselect all selected shapes, export to image and finally select the stored shapes again. I hope this help.
  7. Aakansha
    Aakansha avatar
    20 posts
    Member since:
    Sep 2014

    Posted 27 Sep 2014 in reply to Ciro Link to this post

    Hello Ciro,

    I didnt understand how will I implement that? Can you share some code snippet implementing this, if possible? That will help me get the clarity.
Back to Top
UI for WPF is Visual Studio 2017 Ready