I've been using Tchart->Export->Image->PNG->Width and Height to control the size of exported images. When these are different than the displayed plot size, the exporter regenerates the plot, changing the number of gridlines, etc.
Is there a way to specify an export size that results in resampling the original plot instead, i.e., just changing the export resolution without changing the contents of the plot?
export image size regenerates plot
export image size regenerates plot
Matt Garrett
CRTech
Boulder, Colorado, USA
CRTech
Boulder, Colorado, USA
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: export image size regenerates plot
Hello,
Maybe the easiest way to do this would be to export to a Bitmap and then resize, e.g.MattG wrote:Is there a way to specify an export size that results in resampling the original plot instead, i.e., just changing the export resolution without changing the contents of the plot?
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
Bitmap bmp = ResizeImage(tChart1.Bitmap, new Size(1200, 900));
bmp.Save(@"C:\tmp\MyPNG.png", System.Drawing.Imaging.ImageFormat.Png);
}
public Bitmap ResizeImage(Bitmap imgToResize, Size size)
{
Bitmap b = new Bitmap(size.Width, size.Height);
using (Graphics g = Graphics.FromImage((Image)b))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default; //change this if necessary
g.DrawImage(imgToResize, 0, 0, size.Width, size.Height);
}
return b;
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |