Quality of the image exported

Hi Rooters

When I try to export a TCanvas into a picture (using the Print() method), sometimes the quality is not very good (I am using png format). I think there is a way to control that but I don’t know how.

I found that the TAsImage (that is used to export into png?) has a method called SetImageQuality but I don’t know how to use it.

Any help would be welcome.

Thanks

Do you have some example ? is Gif the same ?

Hi Philippe

Here is an example using 2 format: png and pdf. As you can see, the pdf doesn’t suffer from aliasing (whereas the png does).
On the other hand, the pdf has some problem with the legendd when there are 2 columns. This is probably a bug.
Test.pdf (20.9 KB)


You compare vector graphics and bitmap. Surely vector graphics is better … otherwise why having it ???
PS should be as good as PDF.
I do not see why the text is missing in the PDF case. Have you a very simple example showing this effect ?
May be you are using an old version of ROOT.

Hello,
I have exactly the same problem:

  • If I print my canvas into a pdf file the result is very sharp and very high quality. Even too much, since I am dealing with full colored 2D histograms with a high number of bins, and the resulting pdf is too big and very slow to visualize.
  • If I print my canvas into a gif or png file the result is really blurry and ugly. The files are very light and easy to manipulate, but I can barely distinguish the numbers in the axis labels!

Isn’t there an intermediate solution?

Cheers!

Do you have a small macro showing this effect ?
How does your plot look on screen ? it should be as good as on the screen if you use gif or png (avoid jpeg !!)

Oh! You are right. I set up a low resolution mode for the canvas and this was reflected on the png output.
This was not appreciable in the pdf since it is a scalable vector graphic.
Summarizing, making the canvas bigger (higher resolution) will enhance your png quality.
Thanks!

Yes, unless you are in batch mode the bitmap output reflect what you see on screen.