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

Exported Image is blurred

5 Answers 263 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Ciro
Top achievements
Rank 1
Ciro asked on 26 Jun 2014, 03:36 PM
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

5 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 30 Jun 2014, 08:40 AM
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.
 
0
OlivierDoucy
Top achievements
Rank 1
answered on 26 Sep 2014, 09:51 AM
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
0
Aakansha
Top achievements
Rank 1
answered on 27 Sep 2014, 03:08 AM
While using ExportToImage, I dnt want the focused element to come in the image generated. How can I do that?

0
Ciro
Top achievements
Rank 1
answered on 27 Sep 2014, 07:18 AM
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.
0
Aakansha
Top achievements
Rank 1
answered on 27 Sep 2014, 03:12 PM
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.
Tags
Diagram
Asked by
Ciro
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
OlivierDoucy
Top achievements
Rank 1
Aakansha
Top achievements
Rank 1
Ciro
Top achievements
Rank 1
Share this question
or