Minimum working example for transparent canvas

I am playing with transparent canvases, I read the doc for TAttFill and some discussions in the mailing list, but still it does not work. Here is my minimal working example which does not work. Could someone modify it in order to make it working?

[code]{
TCanvas * can = new TCanvas(“can”, “can”, 800, 600);

can->SetFillStyle(4000);
can->SetFillColor(10);

can->Draw();

can->Print("test.eps");

TImage *img = TImage::Create();
img->FromPad(can);
img->WriteImage("test.png");

delete img;

}[/code]

try:

{
   TCanvas *c1 = new TCanvas("c1", "c1",10,45,700,502);
   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = 1179;
   color = new TColor(ci, 1, 0, 0, " ", 0.);
   c1->SetFillColor(ci);
   c1->Print("c1.png");
}

I see red background. I use feh for viewing and feh gives me chessboard pattern for transparency, so I am convinced that red is not transparent.

Maybe this will be helpfull:

$ root-config --features asimage astiff bonjour builtin_afterimage builtin_ftgl builtin_glew cintex exceptions explicitlink fftw3 fortran gviz genvector krb5 ldap mathmore memstat mysql odbc opengl python reflex shadowpw shared sqlite ssl thread tmva xft xml x11

With X11 the transparency does not work. But the png should be fine. Is the png red also ? it should be white.

root.cern.ch/doc/master/classTColor.html#C07

Yes, the picture is red. I can generate transparent picture with gimp and then I see it is transparent (chessboard pattern).

is the png white ?

No, the PNG is red, definitely is not transparent.

The Canvas background should be a special case. I need to check.

Has this been resolved?

Under X11 (and possibly Wayland or XWayland… not sure…I have forced X11, but not the others), I find that only saving to PDF renders transparency properly (and TEX, but that depends on the tex generator, not ROOT) , both for this example and for others. Neither PNG nor JPG do.

I am running ROOT 6.08.04 from the official Fedora 25 repo.

In fact if you run ROOT in interactive mode with an X11 version of ROOT, the png is red because it is a screen dump from the canvas on screen. But if you start root in batch mode with option -b then the png will be white (transparent) because in that case it is not a screen dump from the canvas on screen. I just verify it on ma computer.