Low resolution image with TASImage

Dear rooters,

I am trying to draw a logo in my plots using the class TASImage. For this I just do the following,

TPad logo_pad = new TPad(“logo_pad”,“Logo pad”,lowX,lowY,highX ,highY);
logo_pad->Draw();
logo_pad->cd();
TASImage
logo = new TASImage(“logo_image_file.png”);
logo->Draw(“xxx”);

where the pad is drawn in a TCanvas object.

The logo effectively gets drawn, but the resolution is quite poor. Is there any way to improve the quality of the logo image?.

Many thanks,

Alejandro

what is the size of the image logo_image_file.png ?

What do you mean about the size?

If by the size you mean the file size, it is 385K.

I also tried to do

logo->SetImageQuality(TAttImage::kImgBest);

and the result is the same.

I just discovered that the problem with the low resolution of the logo is at the moment when I save the plots in eps format. When I just plot the canvas the logo quality is good.

Any ideas?

Something else, I also traied with a logo image in eps format and the resultsis the same after saving the plots in eps format.

size in pixel … along x and y axis

I don’t know. Do you know how to extract this information from a png or eps file?

Try:

identify file.png

Hello,

I ran the indentify command on both png and eps versions of the image. This is what I got,

$ identify logo.png
logo.png PNG 756x807 756x807+0+0 8-bit DirectClass 394KB 0.000u 0:00.000
$ identify logo.eps
logo.eps PS 545x576 545x576+0+0 16-bit DirectClass 194KB 0.000u 0:00.00

Does it is helpful? Let me know if you need more info.

Thanks

That seems quite large and the definition should be good enough.
Can you post the png image and the macro you used to display it ?

I don’t use a simple macro. Its is actually a package.

What I essentially do is,

TCanvas* c1 = new TCanvas(“c1”,“c1”);
c1->SetFillColor(10);
c1->SetFrameFillColor(10);
c1->SetTickx(1);
c1->SetTicky(1);
c1->SetLeftMargin(0.15);
c1->SetBottomMargin(0.15);

c1->Print(“outputfile.eps[”);

c1->Clear();
//plotting some histos and graphs.

c1->cd();
TPad logo_pad = new TPad(“logo_pad”,“Logo pad”,lowX,lowY,highX,highY);
logo_pad->Draw();
logo_pad->cd();
TASImage
logo = new TASImage(logo_image);
logo->SetImageQuality(TAttImage::kImgBest);
logo->Draw(“xxx”);

c1->Print(“outputfile.eps”);

c1->Print(“outputfile.eps]”);

In this way I produce a multi-page eps file.

{
   TCanvas *c = new TCanvas();
   c->Draw();
   TPad *logo_pad = new TPad("logo_pad","Logo pad",0.1,0.7,0.3 ,1.);
   logo_pad->Draw();
   logo_pad->cd();
   TASImage *logo = new TASImage("logo.png");
   logo->Draw("xxx");
}

give me this:

which is not to band seems to me.

The logo looks good in the canva display. The problem is when you save it in eps format. This is what I get

Look at the logo in the middle of the plots. The definition is not good.

I also saved the canvas in a root format and the logo looks good.

Sorry, the logo when displaying the .root format canvas looks ugly as well.

I did this

{

TH1F *h1 = new TH1F(“h1”,“h1”,100,-5.0,5.0);
h1->FillRandom(“gaus”,10000);

TH1F *h2 = new TH1F(“h2”,“h2”,100,-5.0,5.0);
h2->FillRandom(“gaus”,100000);

TString EPSName = TString(“outfile”) + TString(".eps");
TString EPSNameO = EPSName + TString("[");
TString EPSNameC = EPSName + TString("]");

TCanvas* c1 = new TCanvas(“c1”,“c1”);
c1->SetFillColor(10);
c1->SetFrameFillColor(10);
c1->SetTickx(1);
c1->SetTicky(1);
c1->SetLeftMargin(0.15);
c1->SetBottomMargin(0.15);
//c1->SetRightMargin(0.15);

c1->Print(EPSNameO.Data());

c1->Clear();
c1->Divide(2,2);
c1->cd(1);
h1->Draw();
c1->cd(4);
h2->Draw();
c1->cd();
TPad *logo_pad = new TPad(“logo_pad”,“Logo pad”,0.5 - 0.1,0.5 - 0.1,0.5 + 0.1,0.5 + 0.1);
logo_pad->Draw();
logo_pad->cd();
TASImage *logo = new TASImage(“Guariguanchi_logo.png”);
logo->Draw(“xxx”);
c1->Print(EPSName.Data());

c1->Print(EPSNameC.Data());

}

The results that I get is

As you can see the logo is not as high definition as the original image.

Yes when you save to eps a reduce version of the logo you lose the original high definition of the png logo. The new size in eps in may be 100x100 …

Is there any way to preserve the original resolution?