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
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
0
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:
Regards,
Petar Mladenov
Telerik
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
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.
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.