Export to image. Resolution of image too low.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Erwin
Newbie
Newbie
Posts: 4
Joined: Tue Jun 21, 2005 4:00 am

Export to image. Resolution of image too low.

Post by Erwin » Thu Dec 08, 2005 7:19 am

Dear Sir/Madam,

When exporting the TChart to JPEG (Quality = 100), TIF, WMF, ... we noticed that the image resolution was not high enough.


Our code :

Steema.TeeChart.Export.JPEGFormat jPEG;
jPEG = tChart2.Export.Image.JPEG;
jPEG.Height = tChart1.Height;
jPEG.Width = tChart1.Width;
jPEG.Quality =100;
jPEG.Save(outputPath);

or

tChart1.Export.Image.Metafile.bEnhanced = true;
tChart1.Metafile.Save(outputPath,System.Drawing.Imaging.ImageFormat.Emf);

Is there a way to increase the resolution of the exported image ?

Thanks & Kind regards,
Erwin

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 12, 2005 4:06 pm

Hi Erwin,

You could try setting the Quality property, at TChart's editor 3D tab, to "Best Quality" or "Antialias".

You can also set it using:

Code: Select all

			tChart1.Graphics3D.SmoothingMode= System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Erwin
Newbie
Newbie
Posts: 4
Joined: Tue Jun 21, 2005 4:00 am

Post by Erwin » Tue Dec 13, 2005 8:05 am

Hi,

I have tested the settings you suggested but there was no improvement found on resolution of the exported image.

The problem is not the quality of the chart. It's the quality of the exported image who's resolution is too low.

I did following tests :
* I exported the image to JPEG and EMF file, opened it in Microsoft Office Picture Manager and printed (on paper) the image. => RESULT : Quality = POOR.

* I printed (on paper) the image from within my application using : Chart1.Printer.Preview(); => RESULT : Quality = GOOD.

Because of the fact that the imagefile will be picked up by an other process (documentgenerator) that uses the image and fits it into a document, we need to export the chart to an image first.

Is there a way to increase the resolution of the image file?

Kind regards,
Erwin

[/list]

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 13, 2005 11:18 am

Hi Erwin,

To get the same results as you, could you please let us know which TeeChart version are you using?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Erwin
Newbie
Newbie
Posts: 7
Joined: Tue Jun 21, 2005 4:00 am

Post by Erwin » Tue Dec 13, 2005 11:57 am

Hi,

My version of the TeeChart.dll = 2.0.1992.14012

Erwin

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 13, 2005 1:05 pm

Hi Erwin,

We have tested again here using latest Debug Build version available at our Customer Download Area and there is almost no noticeable difference between the WinForm, the JPEG and the EMF file. Can you please download this version and test if it works at your end?

BTW: The code I used to create the images was:

Code: Select all

		private void button2_Click(object sender, System.EventArgs e)
		{
			Steema.TeeChart.Export.JPEGFormat jpeg = tChart1.Export.Image.JPEG;
			jpeg.Quality = 100;
			jpeg.Save(@"C:\temp\chart.jpeg");
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			System.Drawing.Imaging.Metafile m = tChart1.Metafile;
			m.Save(@"C:\temp\chart.emf", System.Drawing.Imaging.ImageFormat.Emf);
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Erwin
Newbie
Newbie
Posts: 7
Joined: Tue Jun 21, 2005 4:00 am

Post by Erwin » Wed Dec 14, 2005 1:17 pm

Hi Narcis,

I downloaded the latest debug build version (2.0.2105.30289) and tested the export to image function again. This had no possitive result.
I also installed the latest release version, but again it had no effect.

The quality is still poor. You can see this when you look at the labels. Compare the labels at the X and Y axe from a printout (on paper !) made with the Teechart.Printer.preview function and the printout (on paper !) of the JPEG file. You should see definitely the difference in quality between the 2 printouts.
I even tried the "Demoproject", that comes with the installation of TeeChart, and compared the printouts of our JPEG file with the one we made with the demoproject : They both have the same problem with the quality of the labels.

Is there a way to send you some of samples of our JPEG-files ? So you could see it yourself?

Kind regards,
Erwin

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Dec 15, 2005 11:52 am

Hi Erwin,

TeeChart uses code virtually identical to the following:
http://tinyurl.com/cuz3e
or
http://groups.google.es/group/microsoft ... ges.csharp
/browse_frm/thread/e6f5f06cc3eb3c25/0ace6f1bef1e9269?lnk=st&q
=creating+jpeg+files+in+c%23+group%3Amicrosoft.public.dotnet.*
&rnum=2&hl=en#0ace6f1bef1e9269

to create its JPEG files with the Quality property being the equivalent of the getQuality() method. The bitmap we pass to our version of this method is the one that can be accessed from the Steema.TeeChart.TChart.Bitmap property and is created thus:

Code: Select all

Bitmap b = new Bitmap(width, height, pixelformat); //width and height of chart
 Draw(Graphics.FromImage(b)); //internal teechart draw method
 return b;
This methodology is completely standard to the .NET Framework, as you can see, and as yet we have been able to find an alternative way to create JPEG files. You may like to experiment yourself with JPEG file creation using the Bitmap available from the Steema.TeeChart.TChart.Bitmap property to see if you can find a better way to create a JPEG. If you do, please don't hesitate to let us know :)
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Erwin
Newbie
Newbie
Posts: 7
Joined: Tue Jun 21, 2005 4:00 am

Post by Erwin » Fri Dec 16, 2005 10:39 am

Hi,

Is the bitmap image (Steema.TeeChart.TChart.Bitmap) of the chart also used when printing the image directly to the printer or is this done another way? And when exporting the chart to a PDF, is the TChart.Bitmap used here ?

Best regards,
Erwin

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Fri Dec 16, 2005 12:32 pm

Hi,

Printing uses the Graphics of the System.Drawing.Printing.PrintPageEventArgs thus:

Code: Select all

e.Graphics.DrawImage(m /*metafile from Steema.TeeChart.TChart.Metafile*/,r /*rectangle to draw to*/ ,chart.chartBounds,GraphicsUnit.Pixel);
where Steema.TeeChart.TChart.Metafile is basically created thus:

Code: Select all

Bitmap bitmap = new Bitmap(1, 1, PixelFormat.Format24bppRgb);
Graphics gRef = Graphics.FromImage(bitmap);
IntPtr hDC = gRef.GetHdc();
Metafile mf = new System.Drawing.Imaging.Metafile(new MemoryStream(), hDC);
gRef.ReleaseHdc(hDC);
gRef.Dispose();
gRef = Graphics.FromImage(mf);
aChart.Draw(gRef, new Rectangle(0, 0, width, height)); //internal Draw method
Again, all very standard .NET procedure for drawing to a printer canvas and for Metafile creation.

PDF exportation is a different issue as the PDF has its own proprietory "canvas language" which PDF readers can render. TChart has its own Steema.TeeChart.Drawing.Graphics3DPDF class to interpret its .NET native canvas primitives to PDF's "canvas language".
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply