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

Chart Dpi settings

4 Answers 97 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 17 Nov 2010, 12:25 AM
Is there a way to set the DPI settings for the chart image.  I did notice an internal property for BitmapResolution;however I did not see anyway thru the control to set that.

While I could use the code below to save a 300dpi image of the chart, isn't the source images (the generated chart) dpi set to the chart defaults? 
System.Drawing.Bitmap image = RadChart1.GetBitmap() as System.Drawing.Bitmap; 
image.SetResolution(300, 300); 
image.Save(@"C:\myimage.png");

I would not want to take at 96dpi image and convert it into a 300dpi image, where are those extra dpi's gonna come from? I think of that like taking a 200px X 200px image and resizing to 400px X 400px, which would not produce the same quality image I would get pixelation. 

I have created a Chart generator control where the user can enter data etc.. and generate the chart from the data.  Then I want to allow them to save the generated chart image at a minimum of 300dpi since this will be added to a print ready pdf.  I would want a high quality image produced since this is for printing.

I appreciate any information or advice on this matter.

Thank you!

4 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Milev
Telerik team
answered on 19 Nov 2010, 05:40 PM
Hi David,

Generally speaking the DPI setting for an image is independent of the number of pixels contained within. So if you are generating let's say a 960 x 960 pixel image at 96 DPI its size on screen will be 10 inches. However, if you set DPI to be 300 (for print for example) then the physical size of the image will be 3.2 inches. In order for the image to be the same size on a 300DPI media you will need to increase detail (pixels) as you have correctly guessed in your post.

You can calculate the number of pixels increase lke this: 300/96 = 3.125. This is the ratio by which you need to expand the image. So 960 x 3.125 = 3,000 pixels. So simply increase the dimensions of the chart to that new number of pixels and set a resolution of 300 DPI. The end result should be the same physical size without any loss in detail.

All the best,
Vladimir Milev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
David
Top achievements
Rank 1
answered on 08 Dec 2011, 08:14 PM
That is exactly what I did and it worked great.

Sorry, I never did come back to mark this as answered last year :)   Better late than never.
0
David
Top achievements
Rank 1
answered on 08 Dec 2011, 08:14 PM
That is exactly what I did and it worked great.

Sorry, I never did come back to mark this as answered last year :)   Better late than never.
0
David
Top achievements
Rank 1
answered on 08 Dec 2011, 08:14 PM
That is exactly what I did and it worked great.

Sorry, I never did come back to mark this as answered last year :)   Better late than never.
Tags
Chart (Obsolete)
Asked by
David
Top achievements
Rank 1
Answers by
Vladimir Milev
Telerik team
David
Top achievements
Rank 1
Share this question
or